自己的Mac之前已安装过zsh,然后在iTerm2中,用着还凑合。
但是不够好,没有之前给公司Mac安装的好用。
此处:tab时,都无法列出来所有选项,而是直接匹配了其中某个,且不是我们希望的。
以及保留上次和最近的输入命令,没法通过箭头匹配出完整的命令。
-》后来才知道是:zsh的插件,叫做zsh-autosuggestion 起的效果
参考之前的:
【已解决】mac的iterm2安装oh-my-zsh
去重新安装一遍。
改主题
1 | ZSH_THEME= "af-magic" |
为:
1 2 3 | ➜ ~ cat ~/.zshrc | grep THEME #ZSH_THEME="robbyrussell" ZSH_THEME= "af-magic" |
新开的iTerm2终端就能看到新主题的效果了:
右边显示当前用户

先确认pip版本:
1 2 3 4 5 | ~ » which pip pip: aliased to noglob pip ------------------------------------------------------------ ~ » pip --version crifan@licrifandeMacBook-Pro pip 20.0.2 from /Users/crifan/ .pyenv /versions/3 .7.3 /lib/python3 .7 /site-packages/pip (python 3.7) |
再去:
1 2 3 4 5 6 7 8 9 10 11 | ~ » pip show powerline-status crifan@licrifandeMacBook-Pro Name: powerline-status Version: 2.7 Summary: The ultimate statusline /prompt utility. Home-page: https: //github .com /powerline/powerline Author: Kim Silkebaekken Author-email: kim.silkebaekken+vim@gmail.com License: MIT Location: /Users/crifan/ .pyenv /versions/3 .7.3 /lib/python3 .7 /site-packages Requires: Required-by: |
安装字体
1 2 3 | git clone https: //github .com /powerline/fonts .git --depth=1 cd fonts . /install .sh |
过程日志:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ➜ ~ cd Downloads ➜ Downloads git clone https: //github .com /powerline/fonts .git --depth=1 Cloning into 'fonts' ... remote: Enumerating objects: 310, done . remote: Counting objects: 100% (310 /310 ), done . remote: Compressing objects: 100% (236 /236 ), done . remote: Total 310 (delta 75), reused 260 (delta 71), pack-reused 0 Receiving objects: 100% (310 /310 ), 10.40 MiB | 101.00 KiB /s , done . Resolving deltas: 100% (75 /75 ), done . ➜ Downloads cd fonts ➜ fonts git:(master) . /install .sh Copying fonts... Resetting font cache, this may take a moment... Powerline fonts installed to /Users/crifan/Library/Fonts |
去iTerm2中设置字体
Meslo LG S DZ for Powerline

1 2 3 | git clone https: //github .com /altercation/solarized cd solarized /iterm2-colors-solarized/ open . |

1 2 | Colors Scheme Imported The color scheme was imported and added to presets. You can find it under Preferences>Profiles>Colors>Load Presets…. |

再去iTerm2中设置Colors:

为Solarized Dark
效果是:

不过感觉还是没有之前的:
Tango Dark 好看

再去安装主题
1 2 3 | git clone https: //github .com /fcamblor/oh-my-zsh-agnoster-fcamblor .git cd oh-my-zsh-agnoster-fcamblor/ . /install |
log
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | ➜ Downloads git clone https: //github .com /fcamblor/oh-my-zsh-agnoster-fcamblor .git Cloning into 'oh-my-zsh-agnoster-fcamblor' ... remote: Enumerating objects: 136, done . ^Cceiving objects: 37% (51 /136 ), 260.01 KiB | 31.00 KiB /s ➜ Downloads git config --global http.https: //github .com.proxy socks5: //127 .0.0.1:1080 ➜ Downloads git clone https: //github .com /fcamblor/oh-my-zsh-agnoster-fcamblor .git Cloning into 'oh-my-zsh-agnoster-fcamblor' ... remote: Enumerating objects: 136, done . remote: Total 136 (delta 0), reused 0 (delta 0), pack-reused 136 Receiving objects: 100% (136 /136 ), 1.14 MiB | 963.00 KiB /s , done . Resolving deltas: 100% (59 /59 ), done . ➜ Downloads cd oh-my-zsh-agnoster-fcamblor/ ➜ oh-my-zsh-agnoster-fcamblor git:(master) . /install Creating symlink from here to your oh-my-zsh themes path... Done ! (the symlink is ~/.oh-my-zsh /themes/agnoster-fcamblor .zsh-theme) ---------------------------------------------------------------------------------- Options: All options must be overridden in your .zshrc file . See README.md for more info. ---------------------------------------------------------------------------------- Requirements: Vim Powerline patched font: See Powerline for vim for more info. Z shell (zsh): See oh-my-zsh for more info. Make sure terminal is using 256-colors mode with export TERM= "xterm-256color" . |
把主题改为agnoster:
1 2 3 4 | ➜ oh - my - zsh - agnoster - fcamblor git:(master) cat ~ / .zshrc| grep THEME #ZSH_THEME="robbyrussell" #ZSH_THEME="af-magic" ZSH_THEME = "agnoster" |
立刻生效方式:
- 重启iTerm2
- Command+Q退出再重新打开iTerm2
- source
- source ~/.zshrc
效果:

再去安装高亮插件:
1 2 3 | cd ~/.oh-my-zsh /custom/plugins/ git clone https: //github .com /zsh-users/zsh-syntax-highlighting .git vi ~/.zshrc |
本身已有:
1 | plugins=(git osx brew python pip virtualenv docker github gitignore gnu-utils svn yum debian systemd terminalapp pod) |
去加上zsh-syntax-highlighting
1 2 3 4 5 6 7 | crifan@licrifandeMacBook - Pro ~ / .oh - my - zsh / custom / plugins master cat ~ / .zshrc| grep plugins # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ # Example format: plugins=(rails git textmate ruby lighthouse) # Add wisely, as too many plugins slow down shell startup. plugins = (git osx brew python pip virtualenv docker github gitignore gnu - utils svn yum debian systemd terminalapp pod zsh - syntax - highlighting) # plugins, and themes. Aliases can be placed here, though oh-my-zsh |
再去生效:
1 | source ~/.zshrc |
可见 ls和ll都高亮了:

1 2 3 | cd ~/.oh-my-zsh /custom/plugins/ git clone https: //github .com /zsh-users/zsh-autosuggestions vi ~/.zshrc |
log
1 2 3 4 5 6 | crifan@licrifandeMacBook-Pro ~/.oh-my-zsh /custom/plugins master git clone https: //github .com /zsh-users/zsh-autosuggestions Cloning into 'zsh-autosuggestions' ... remote: Enumerating objects: 2385, done . remote: Total 2385 (delta 0), reused 0 (delta 0), pack-reused 2385 Receiving objects: 100% (2385 /2385 ), 541.32 KiB | 775.00 KiB /s , done . Resolving deltas: 100% (1531 /1531 ), done . |
加上:
1 2 3 4 | xxx ~/.oh-my-zsh /custom/plugins master cat ~/.zshrc | grep plugins ... plugins=(git osx brew python pip virtualenv docker github gitignore gnu-utils svn yum debian systemd terminalapp pod zsh-autosuggestions zsh-syntax-highlighting) ... |
生效后,输入了一部分后,立刻自动匹配,之前的,历史命令:

效果很爽-》经常用,能省很多时间。
另外颜色最后还是去换:

Solarized Dark
感觉稍微柔和些。是不错。
【总结】
参考:
或之前自己的:
【已解决】mac的iterm2安装oh-my-zsh
最终效果很不错:
其中,最实用的,感觉是:zsh-autosuggestions
-》自动匹配完成历史命令的感觉,太爽了。
转载请注明:在路上 » 【已解决】Mac中升级效果更好的on-my-zsh和自动补全