zsh & oh-my-zsh 安装
发表于更新于
北京
本文介绍了 zsh & oh-my-zsh 和一些插件的安装过程。
一、安装
1 2 3 4 5 6
| apt-get install zsh
yum install zsh
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
|
二、主题
1 2 3 4 5 6
| vim ~/.zshrc
ZSH_THEME="agnoster"
|
三、插件
1. zsh-syntax-highlighting
高亮语法,输入正确语法会显示绿色,错误的会显示红色,使得我们无需运行该命令即可知道此命令语法是否正确。
1 2 3 4 5 6 7 8 9 10
| git clone https://gitee.com/chenming_c/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
vim ~/.zshrc
plugins=(其他的插件 zsh-syntax-highlighting)
source ~/.zshrc
|
2. zsh-autosuggestions
自动补全,只需输入部分命令即可根据之前输入过的命令提示,按右键 → 即可补全。
1 2 3 4 5 6 7 8 9 10
| git clone https://gitee.com/chenming_c/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
vim ~/.zshrc
plugins=(其他的插件 zsh-autosuggestions)
source ~/.zshrc
|
一个 zsh 自带的插件,让你不需要再记关于解压的任何命令,直接执行 extract <filename> 即可。
1 2 3 4 5 6 7
| vim ~/.zshrc
plugins=(其他的插件 extract)
source ~/.zshrc
|
4. z
一个 zsh 自带的插件,可以直接进行目录跳转 z <dirname> 即可。
1 2 3 4 5 6 7
| vim ~/.zshrc
plugins=(其他的插件 z)
source ~/.zshrc
|
四、卸载
五、快速安装(可选)
1 2 3 4 5 6 7 8 9
| git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc chsh -s $(which zsh)
git clone https://gitee.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting git clone https://gitee.com/zsh-users/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
ZSH_THEME="fino" plugins=(git zsh-syntax-highlighting zsh-autosuggestions extract z)
|