安装

非常简单

  1. sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装完成后 ~/.zshrc 会被覆盖,如果先安装了 nvm 等可能会因为覆盖而无法使用。不要慌,zsh 安装完成后已经自动将原有的配置自动到同级目录下,名字为 .zshrc.pre-oh-my-zsh 。只需要将这里面的内容重新手动复制到 .zshrc 里,原来的功能就恢复了。

常用插件

主题

  1. ZSH_THEME="ys"

更多主题

插件

1. autojump

  1. # 安装步骤
  2. # ------ mac -------
  3. brew install autojump
  4. vim ~/.zshrc
  5. # 在文件里找到plugins,添加
  6. plugins=(autojump)
  7. # 在文件末尾添加
  8. [[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh
  9. source $ZSH/oh-my-zsh.sh
  10. # 最后
  11. source ~/.zshrc
  12. # ------ linux -----
  13. git clone git://github.com/joelthelion/autojump.git
  14. cd autojump
  15. ./install.py
  16. vim ~/.zshrc
  17. # 在文件里找到plugins,添加
  18. plugins=(autojump)
  19. # 在文件末尾添加
  20. [[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
  21. source ~/.zshrc

image.png
image.png

2. zsh-autosuggestion

  1. # 安装
  2. git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
  3. vim ~/.zshrc
  4. # 在文件里找到plugins,添加
  5. plugins=(
  6. autojump
  7. zsh-autosuggestions
  8. )
  9. source ~/.zshrc

image.png

参考文章

oh-my-zsh让终端好用到飞起~