- 首先:安装官方源的 zsh
$ sudo pacman -S zsh
安装 wget 、git 并获取开源项目的安装脚本
$ sudo pacman -S wget
$ sudo pacman -S git
$ wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh
$ chmod +x install.sh
$ ./install.sh
- 设置zsh为默认shell:
$ sudo chsh -s /bin/zsh xxx # xxx 为用户名
- 选择适合你的主题
#==========================================================================
# 主题的设置文件在 : ~/.zshrc
# 主题的存放目录在 : ~/.oh-my-zsh/themes
# 推荐主题 : ZSH_THEME="crcandy"
#==========================================================================
ZSH_THEME="robbyrussel" # 这是默认主题 robbyrussel ,更改别的主题只需替换这个名字即可。
ZSH_THEME="random" # 如果一时之间找不到合适的,可以用:random 这里会随机获取主题。
$ echo $RANDOM_THEME # 然后使用 echo 命令读取当前主题,可以将喜欢的主题保存到 ZSH_THEME。
4.小技巧
4.1 给history命令增加时间
$ vim ~/.zshrc
HIST_STAMPS="yyyy-mm-dd"
source ~/.zshrc
4.2 更新oh-my-zsh
# 设置自动更新oh-my-zsh : ~/.zshrc
DISABLE_UPDATE_PROMPT=true
# 加入需要手动更新
$ upgrade_oh_my_zsh
6.设置插件
# 插件存放的目录 : ~/.oh-my-zsh/plugins
# 插件设置 plugins=(插件名)
plugins=(git) # 默认启用git插件
# 网上推荐的几个好用插件:
zsh-history-substring-search
https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/history-substring-search
zsh-syntax-highlighting
https://github.com/zsh-users/zsh-syntax-highlighting
zsh-autosuggestions
https://github.com/zsh-users/zsh-autosuggestions
更多插件可参考
https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins
https://github.com/unixorn/awesome-zsh-plugins
https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins-Overview
- 关于卸载
uninstall_oh_my_zsh # 直接命令行输入
网友评论