1. 安装zsh
2. 将zsh设置为默认shell
a. 修改/etc/passwd
b. 在欲使用zsh的用户后面将shell由/bin/bash改为/usr/bin/zsh
3. 安装oh my zsh
a. wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
4. 设置zsh
a. 修改主题
i. 在 .zshrc 里面修改ZSH_THEME="tonotdo",此时主题为tonotdo,主题列表https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
b. 添加插件
i. 在 .zshrc 里面的 plugins=(git) 行的git后面添加插件名字,我的为 plugins=(git zsh-autosuggestions zsh-syntax-highlighting autojump extract)说明我安装了括号里的所有插件
ii. 其中有的插件需要安装额外的东西或者添加额外的内容到 .zshrc 中
1) autojump
a) 先用apt安装autojump,
b) 安装好之后,需要在~/.zshrc中配置一下,除了在plugins中增加autojump之外,还需要添加一行:
[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
c) 安装好之后,记得source ~/.zshrc
2) zsh-autosuggestions
a) sudo git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH/custom/plugins/zsh-autosuggestions
3) zsh-syntax-highlighting
a) sudo git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/custom/plugins/zsh-syntax-highlighting
4) extract
a) 解压文件用的,所有的压缩文件,都可以直接x filename,不用记忆参数
当然,如果你想要用tar命令,可以使用tar -加tab键,zsh会列出参数的含义。
c. 若要修改主题,把在$ZSH/themes的主题复制到$ZSH/custom/themes中去,然后再修改,因为custom中的配置会覆盖原配置
d. 去掉提示命令的下划线
i. 在.zshrc中添加如下内容
ZSH_HIGHLIGHT_STYLES[path]=none
ZSH_HIGHLIGHT_STYLES[path_prefix]=none
e. source ~/.zshrc
配置 zsh
最新推荐文章于 2025-05-12 21:13:33 发布