记录一下Ubuntu&Mac配置zsh
Ubuntu下配置zsh
安装
安装zsh并修改shell为zsh
1
2
3
4
5sudo apt-get install zsh
chsh -s /bin/zsh
若系统中没有git,需要安装git
sudo apt-get install git安装oh-my-zsh
1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
安装zsh-syntax-highlighting语法高亮插件
1
2
3git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
echo "source ${(q-)PWD}/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ${ZDOTDIR:-$HOME}/.zshrc
source ~/.zshrc安装zsh-autosuggestions语法历史记录插件
克隆插件到本地
1
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
克隆后使用vim编辑~/.zshrc文件
1
vim ~/.zshrc
在plugins中加入
zsh-autosuggestions
并在最后一行加入
1
source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
保存后source一下
1
source ~/.zshrc
卸载
1 | sudo sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/uninstall.sh)" |
Mac下配置zsh
安装
安装zsh
1
brew install zsh
修改默认Shell
编辑
/etc/shells
文件,在文件中加入1
2
3/usr/local/bin/zsh
或者
/bin/zsh运行命令
1
2
3chsh -s /usr/local/bin/zsh
或者
chsh -s /bin/zsh
安装oh-my-zsh
若系统中无git,先安装git
1
sudo brew install git
安装oh-my-zsh
1
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
高亮和历史记录插件和上面ubuntu的一样