当前位置:   article > 正文

mac 配置iTerm2和oh-my-zsh主题_iterm2主题推荐

iterm2主题推荐
一、安装iTerms2
chsh -s /bin/zsh
  • 1
二、安装oh-my-zsh
  • 根据官网,使用curl或者wget下载
# curl 方式
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# 或 wget 方式
$ sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"
  • 1
  • 2
  • 3
  • 4
  • 5
  • 注意:由于“不知名原因”,可能出现无法下载情况,如:installer: Failed to connect to github: Connection refused
  • 直接用git clone下载
git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
  • 1
  • 2
三、iTerms2换主题搭色
  • 修改主题,改用agnoster
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
# ZSH_THEME="robbyrussell"
ZSH_THEME="agnoster"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

请添加图片描述

  • 使用Dark Backgrounp,修改显示颜色,Blue改成268bd2,Yellow改用b58900,参考Preferences——Profiles——colors——Color Presets——Solarized Dark配色
    请添加图片描述
    请添加图片描述

  • 隐藏用户名和主机名,vim ~/.oh-my-zsh/themes/agnoster.zsh-theme,注释if语句里面哪一行

### Prompt components
# Each component will draw itself, and hide itself if no information needs to be shown

# Context: user@hostname (who am I and where am I)
prompt_context() {
  if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
    # prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
  fi
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

请添加图片描述

  • 修改字体
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
  • 1
  • 2
  • 3

请添加图片描述
在这里插入图片描述

四、安装插件
  • 安装目录跳转工具(autojump是一个命令行工具,它允许你可以直接跳转到你喜爱的目录,而不受当前所在目录的限制。意思就是可以让你更快地切换目录,而不用频繁地使用cd tab 等命令。)
brew install autojump
  • 1
  • 安装自动补全插件
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-autosuggestions.git
  • 1
  • 2
  • 安装命令高亮插件
cd ~/.oh-my-zsh/custom/plugins
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
  • 1
  • 2
  • 加载命令配置
echo '
[ -f /usr/local/etc/profile.d/autojump.sh ] && . /usr/local/etc/profile.d/autojump.sh
source ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
source ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
' >> ~/.zshrc

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 在 ~/.zshrc 中修改 plugins=(git) 为,zsh-syntax-highlighting要放到最后面
plugins=(
    git
    autojump
    zsh-autosuggestions
    zsh-syntax-highlighting
)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
五、参考
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/868965
推荐阅读
  

闽ICP备14008679号