最终效果
设置iterm2
- 设置配色,个人喜欢Tango dark
- 取消下面的勾选,否则执行一些交互型命令后,滚动的时候会发现之前的历史输入输出会被覆盖了
- 设置自己喜欢的背景图
安装设置zsh
-
zsh的配置很麻烦,所以大家都是通过oh-my-zsh设置zsh,根据oh-my-zsh官网可以通过curl或wget安装
-
安装zsh主题powerlevel10k:
brew install romkatv/powerlevel10k/powerlevel10k
,并根据brew提示,在.zshrc中添加source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme
并将之前的ZSH_THEME设置删掉 -
高版本macos中已经将默认shell从bash改为了zsh,笔者是macos10.14.6,所以需要自己更改默认bash
安装最常用的zsh插件(高亮+自动提示)
- 安装zsh命令行高亮插件
brew install zsh-syntax-highlighting
,并根据brew提示在.zshrc中添加source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
- 安装zsh自动提示插件
brew install zsh-autosuggestions
,并根据brew提示在.zshrc中添加source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
# This speeds up pasting w/ autosuggest
# https://github.com/zsh-users/zsh-autosuggestions/issues/238
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish