Skip to content

Iterm2 + zsh + p10k


Iterm2设置

  1. 透明度:Profiles → Window → Transparancy = 50%
  2. 窗口标题:Profiles → General → Title = PWD
  3. 光标:Profiles → Text → Cursor = Underline
  4. 字体大小:Profiles → Text → Font = 20

Zsh配置

  1. 使用brew安装:brew install zsh,设置主机PS1='%~ '

  2. 安装官方插件:brew install zsh-syntax-highlighting zsh-autosuggestions zsh-history-substring-search

    • zsh-syntax-highlighting:高亮

    • zsh-autosuggestions:命令建议,右键接受建议

    • zsh-history-substring-search:历史命令搜索,上下键搜索

    • 将插件配置写入~/.zshrc

      sh
      plugins=( 
          # other plugins...
          zsh-syntax-highlighting,
          zsh-autosuggestions,
          zsh-history-substring-search
      )
      ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#17d900,bold,underline"
      source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
      
      # zsh-history-substring-search configuration
      bindkey '^[[A' history-substring-search-up # or '\eOA'
      bindkey '^[[B' history-substring-search-down # or '\eOB'
      HISTORY_SUBSTRING_SEARCH_ENSURE_UNIQUE=1
      HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND="fg=#ffffff,bg=#17d900,bold,underline"
      source ~/.oh-my-zsh/custom/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh

安装主题powerlevel10k

  1. 使用brew安装,将配置写入~/.zshrc
sh
brew install powerlevel10k
ZSH_THEME="powerlevel10k/powerlevel10k"
source $(brew --prefix)/share/powerlevel10k/powerlevel10k.zsh-theme
  1. 执行命令p10k configure,自定义配置界面,过程之中可能会下载字体MesloLGS NF
  2. 设置iterm2的字体为MesloLGS NF:Profiles → Text → Font → MesloLGS NF