在Windows拥有Zsh
首先你要先安装好Ubuntu Bash,此处教程.
安装zsh1
sudo apt-get install zsh
启动zsh1
zsh
键入2
创建配置文件
若要退出zsh回到Bash1
exit
设置zsh默认启动
打开配置文件~/.bashrc
1
vim ~/.bashrc
在文件中加入如下几行1
# Launch Zsh
2
if [ -t 1 ]; then
3
exec zsh
4
fi
安装Oh My Zsh1
curl -L https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | bash
2
把 Zsh 设置为当前用户的默认 Shell
3
chsh -s /bin/zsh
设置主题
编辑~/.zshrc
1
vim ~/.zshrc
修改主题为1
ZSH_THEME="amuse"
这个主图需要下载字体
其一 Meslo LG M Regular for Powerline.ttf
更多字体
安装语法高亮插件1
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
配置文件1
$ vim ~/.zshrc
找到这行1
plugins=(git)
改为1
plugins=(git zsh-syntax-highlighting)
保存退出然后更新设置1
source ~/.zshrc
有可能会碰到这样的报错1
[oh-my-zsh] For safety, we will not load completions from these directories until
2
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
3
[oh-my-zsh] See the above list for directories with group or other writability.
4
5
[oh-my-zsh] To fix your permissions you can do so by disabling
6
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
7
[oh-my-zsh] owner of these directories is either root or your current user.
8
[oh-my-zsh] The following command may help:
9
[oh-my-zsh] compaudit | xargs chmod g-w,o-w
10
11
[oh-my-zsh] If the above didn't help or you want to skip the verification of
12
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
13
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.
我最后选择了最次的方法
配置文件1
$ vim ~/.zshrc
在1
export ZSH="/home/Benature/.oh-my-zsh"
前加一行1
ZSH_DISABLE_COMPFIX=true
2
export ZSH="/home/Benature/.oh-my-zsh"
参考资料
- https://www.howtogeek.com/258518/how-to-use-zsh-or-another-shell-in-windows-10/
- https://evdokimovm.github.io/windows/zsh/shell/syntax/highlighting/ohmyzsh/hyper/terminal/2017/02/24/how-to-install-zsh-and-oh-my-zsh-on-windows-10.html
- https://benature.github.io/2019/01/18/Terminal_in_Mac_configuration/