mac 配置iTerm2和oh-my-zsh主题

一、安装iTerms2
chsh -s /bin/zsh
二、安装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 -)"
  • 注意:由于“不知名原因”,可能出现无法下载情况,如: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
三、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

请添加图片描述

  • 使用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
}

请添加图片描述

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

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

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

  • 在 ~/.zshrc 中修改 plugins=(git) 为,zsh-syntax-highlighting要放到最后面
plugins=(
    git
    autojump
    zsh-autosuggestions
    zsh-syntax-highlighting
)
五、参考
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值