一、MacOs系统
MacOs中终端使用iTerm2
1. 配置oh-my-zsh
oh my zsh 的地址: https//github.com/ohmyzsh/ohmyzsh
插件存放位置:~/.oh-my-zsh/plugins 下载常用的插件
git clone http://github.com/zsh-users/zsh-syntax-highlighting.git
修改配置文件
vim ~/.zshrc
plugins=(git zsh-syntax-highlighting)
生效配置
source ~/.zshrc
2. 配置字体
安装字体
brew tap homebrew/cask-fonts
brew cask install font-hack-nerd-font
在ITerm2中配置字体:
iTerm2 > Preferences > Profiles > Text 配置Font
3. 配置powerlevel10
cd ~/.oh-my-zsh/themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git powerlevel10k
将~/.zshrc配置文件中的主题设置为powerlevel10k
ZSH_THEME="powerlevel10k/powerlevel10k"
配置显示的样式
p10k configure
跟随指示选择就好
4. 配置colorls
安装ruby,ruby的版本需要为2.7以上,使用ruby2.6无法安装colorls
brew install ruby
配置ruby环境变量
编辑文件
vim ~/.zshrc
把这个配置放到zshrc里面
export PATH="/usr/local/Cellar/ruby/2.7.2/bin:$PATH"
然后输入一下代码启动
source ~/.zshrc
查看ruby的版本
ruby --version
安装colorls
sudo gem install colorls -n /usr/local/bin
如果安装这个之后出现了warning 那就跟warning报错的路径设置权限
sudo chmod 755 /opt/homebrew/sbin
配置~/.zshrc
vim ~/.zshrc
source $(dirname $(gem which colorls))/tab_complete.sh
alias ll='colorls -lA --sd --gs --group-directories-first'
alias ls='colorls --group-directories-first'
alias lc='colorls' # Colorls with no options
alias l='colorls -l --sort-dirs' # List
#alias ll='colorls -lA --git-status --sort-dirs' # List, show almost all files (excludes ./ and ../)
alias la='colorls -la --sort-dirs' # List, show all files
alias lt='colorls -lt --git-status' # List, sort by modification time (newest first)
alias lS='colorls -lS --git-status' # List, sort by size (largest first)
alias lr='colorls --tree=5' # Show tree heirarchy, capped at depth 5 just in case
alias lx='colorls -lAX --git-status' # List, Sort by file type
5. 最终结果
6.配置文件~/.zshrc 完整内容
ZSH_DISABLE_COMPFIX=true
export ZSH="/Users/juejieli/.oh-my-zsh"
#ZSH_THEME="robbyrussell"
#ZSH_THEME="cloud"
ZSH_THEME="powerlevel10k/powerlevel10k"
#ZSH_THEME="agonster"
POWERLEVEL9K_MODE='nerdfont-complete'
plugins=(git zsh-syntax-highlighting)
source $ZSH/oh-my-zsh.sh
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
export PATH="/usr/local/Cellar/ruby/2.7.2/bin:$PATH"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
alias ll='colorls -lA --sd --gs --group-directories-first'
alias ls='colorls --group-directories-first'
alias lc='colorls' # Colorls with no options
alias l='colorls -l --sort-dirs' # List
#alias ll='colorls -lA --git-status --sort-dirs' # List, show almost all files (excludes ./ and ../)
alias la='colorls -la --sort-dirs' # List, show all files
alias lt='colorls -lt --git-status' # List, sort by modification time (newest first)
alias lS='colorls -lS --git-status' # List, sort by size (largest first)
alias lr='colorls --tree=5' # Show tree heirarchy, capped at depth 5 just in case
alias lx='colorls -lAX --git-status' # List, Sort by file type
source $(dirname $(gem which colorls))/tab_complete.sh