1. MacOs system
Using iTerm2 in Terminal in MacOs
1. Configure oh-my-zsh
The address of oh my zsh : https//github.com/ohmyzsh/ohmyzsh
Plug-in storage location: ~/.oh-my-zsh/plugins Download commonly used plug-ins
git clone http://github.com/zsh-users/zsh-syntax-highlighting.git
Modify configuration file
vim ~/.zshrc
plugins=(git zsh-syntax-highlighting)
Effective configuration
source ~/.zshrc
2. Configure fonts
Install fonts
brew tap homebrew/cask-fonts
brew cask install font-hack-nerd-font
Configure fonts in ITerm2:
iTerm2 > Preferences > Profiles > Text 配置Font
3. Configure powerlevel10
cd ~/.oh-my-zsh/themes
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git powerlevel10k
Set the theme in the ~/.zshrc configuration file to powerlevel10k
ZSH_THEME="powerlevel10k/powerlevel10k"
Configure display style
p10k configure
跟随指示选择就好
4. Configure colorls
Install ruby. The ruby version needs to be 2.7 or above. Colorls cannot be installed using ruby 2.6.
brew install ruby
Configure ruby environment variables
编辑文件
vim ~/.zshrc
把这个配置放到zshrc里面
export PATH="/usr/local/Cellar/ruby/2.7.2/bin:$PATH"
然后输入一下代码启动
source ~/.zshrc
Check ruby version
ruby --version
Install colorls
sudo gem install colorls -n /usr/local/bin
如果安装这个之后出现了warning 那就跟warning报错的路径设置权限
sudo chmod 755 /opt/homebrew/sbin
Configure ~/.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. Final results
6. Complete content of configuration file ~/.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