安装 ohmyzsh

1
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

安装主题 powerlevel9k

1
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/custom/themes/powerlevel9k

修改 ~/.zshrc 中的 ZSH_THEMEZSH_THEME="powerlevel9k/powerlevel9k"

将以下内容添加到文件 ~/.zshrc

1
2
3
4
5
# 主题 powerlevel9k
POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(ssh dir vcs newline status)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
POWERLEVEL9K_PROMPT_ADD_NEWLINE=true

保存后执行 source ~/.zshrc 来使配置生效,如果没有生效可以再执行一次。

配置每次打开后自动生效

编辑文件 ~/.zprofile ,内容为 source ~/.zshrc,这样,每次启动就会自动重载配置文件。

如果是 linux 系统,修改默认 shell 的命令是 chsh -s /bin/zsh

配置自动提示

zsh-autosuggestions 插件会自动从 history 中查找运行过的命令并进行提示和自动补全。

1
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

编辑 ~/.zshrc 中内容,找到 plugins 添加 zsh-autosuggestions 即可。

1
2
3
4
plugins=( 
# other plugins...
zsh-autosuggestions
)

安装 ColorsLS 来使 iTerm 更漂亮

1
sudo gem install colorls

安装 autojump 使用 j <anywhere> 快速进入目录

1
brew install autojump

把以下内容添加到 ~/.zshrc 中。

1
[[ -s $(brew --prefix)/etc/profile.d/autojump.sh ]] && . $(brew --prefix)/etc/profile.d/autojump.sh

修改配色方案

clone dracula/iterm 这个库。

1
git clone https://github.com/dracula/iterm.git

然后在 iTerm2 > Settings... > Profiles > Colors > Color Presets > Import ... 导入这个库的文件,并选中使其生效。

配置图标

1
2
3
4
https://github.com/powerline/fonts

brew tap homebrew/cask-fonts
brew install font-hack-nerd-font

安装 trzsz

如果之前使用过 lrzsz ,那么这个 trzsz 是一个比 lrzsz 更好用上传/下载文件的插件。

1
2
brew update
brew install trzsz-go

配置文档

1
2
3
sudo apt update && sudo apt install software-properties-common python3-launchpadlib
sudo add-apt-repository ppa:trzsz/ppa && sudo apt update
sudo apt install trzsz