1. 首先安装oh-my-zsh
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
2. 安装zsh-autosuggestions
zsh-autosuggestions是一个命令自动补全插件
2.1 下载插件
$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
2.2 配置
编辑~/.zshrc
文件
#打开要编辑的文件
vi ~/.zshrc
# 按i进入--INSERT--编辑模式
# 找到plugins=(git),添加如下内容,插件之间用空格隔空
plugins=(git zsh-autosuggestions)
保存退出
ESC 回到正常模式
:wq保存并退出vim
2.3 重启
方法一:通过关闭终端窗口重新打开的方式更新配置
方法二:通过命令source ./zshrc
3. 安装nvm
因为macOS
直接安装nvm
笨重而繁琐,homebrew
安装的nvm
又不能用,curl
安装不仅需要Xcode Command
支持还需要配.bash_profile
还有官网所提示的一系列问题
因此使用最简单的安装方式,通过安装zsh
的插件zsh-nvm
。虽然说叫插件但是使用起来是和nvm一样的。
3.1 下载插件
$ git clone git://github.com/lukechilds/zsh-nvm.git $ZSH_CUSTOM/plugins/zsh-nvm
3.2 配置
编辑~/.zshrc
文件
#打开要编辑的文件
vi ~/.zshrc
# 按i进入--INSERT--编辑模式
# 找到plugins=(git),添加如下内容,插件之间用空格隔空
plugins=(git zsh-autosuggestions zsh-nvm)
保存退出
ESC 回到正常模式
:wq保存并退出vim
3.3 重启
方法一:通过关闭终端窗口重新打开的方式更新配置
方法二:通过命令source ./zshrc
执行source ./zshrc
后,会自动下载nvm最新版本
$ source ~/.zshrc
Installing nvm...
Cloning into '~/.nvm'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (12/12), done.
Receiving objects: 3% (229/7614), 140.01 KiB | 247.00 KiB/sReceiving objects: 4% (305/7614), 140.01 KiB | 247.00 KiB/sReceiving objects: 5% (381/7614), 140.01 KiB | 247.00 KiB/sReceiving objects: 6% (457/7614), 140.01 KiB | 247.00 KiB/sReceiving objects: 6% (488/7614), 140.01 KiB | 247.00 KiB/sReceiving objects: 7% (533/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 8% (610/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 9% (686/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 10% (762/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 11% (838/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 12% (914/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 13% (990/7614), 348.01 KiB | 327.00 KiB/sReceiving objects: 14% (1066/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 15% (1143/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 16% (1219/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 17% (1295/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 18% (1371/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 19% (1447/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 20% (1523/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 21% (1599/7614), 348.01 KiB | 327.00 KiB/Receiving objects: 22% (1676/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 23% (1752/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 24% (1828/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 25% (1904/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 26% (1980/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 27% (2056/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 28% (2132/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 29% (2209/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 30% (2285/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 31% (2361/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 32% (2437/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 33% (2513/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 33% (2584/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 34% (2589/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 35% (2665/7614), 612.01 KiB | 378.00 KiB/Receiving objects: 36% (2742/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 37% (2818/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 38% (2894/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 39% (2970/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 40% (3046/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 41% (3122/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 42% (3198/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 43% (3275/7614), 956.01 KiB | 449.00 KiB/Receiving objects: 44% (3351/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 45% (3427/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 46% (3503/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 47% (3579/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 48% (3655/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 49% (3731/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 50% (3807/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 51% (3884/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 52% (3960/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 53% (4036/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 53% (4071/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 54% (4112/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 55% (4188/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 56% (4264/7614), 1.25 MiB | 484.00 KiB/s Receiving objects: 57% (4340/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 58% (4417/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 59% (4493/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 60% (4569/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 61% (4645/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 62% (4721/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 63% (4797/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 64% (4873/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 65% (4950/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 66% (5026/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 67% (5102/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 68% (5178/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 69% (5254/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 70% (5330/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 71% (5406/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 72% (5483/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 73% (5559/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 74% (5635/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 75% (5711/7614), 1.71 MiB | 556.00 KiB/s Receiving objects: 76% (5787/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 77% (5863/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 78% (5939/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 79% (6016/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 80% (6092/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 81% (6168/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 82% (6244/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 83% (6320/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 84% (6396/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 85% (6472/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 86% (6549/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 87% (6625/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 88% (6701/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 89% (6777/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 90% (6853/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 91% (6929/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 92% (7005/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 93% (7082/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 94% (7158/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 95% (7234/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 96% (7310/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 97% (7386/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 98% (7462/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 99% (7538/7614), 2.17 MiB | 603.00 KiB/s remote: Total 7614 (delta 6), reused 13 (delta 4), pack-reused 7598
Receiving objects: 99% (7605/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 100% (7614/7614), 2.17 MiB | 603.00 KiB/s Receiving objects: 100% (7614/7614), 2.57 MiB | 655.00 KiB/s, done.
Resolving deltas: 100% (4812/4812), done.