美文网首页
oh-my-zsh 安装使用

oh-my-zsh 安装使用

作者: 万士辰 | 来源:发表于2018-01-22 11:35 被阅读176次

参考文章

cd ~

#oh-my-zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

#font
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts

主题选择

agnoster
进入~/.zshrc打开.zshrc文件,然后将ZSH_THEME后面的字段改为agnoster。
ZSH_THEME="agnoster"(agnoster即为要设置的主题)

字体选择

Meslo LG S DZ Regular for Powerline
12pt

配色选择

Solarized Dark

自定义路径层级深度

oh-my-zsh使用时,路径深度过长,导致使用时非常不方便。
打开.oh-my-zsh/themes/当前使用的风格.zsh-theme
找到

# Dir: current working directory
prompt_dir() {
  prompt_segment blue black '%~'
}

修改成

# Dir: current working directory
prompt_dir() {
  prompt_segment blue black '%3~'
}

其中3代表这路径深度,根据自己使用需求修改

不显示当前用户名

找到

## Main prompt
build_prompt() {
  ……
  prompt_context
  ……
}

修改成

## Main prompt
build_prompt() {
  ……
  #prompt_context
  ……
}

设置多个session不共享历史命令

打开.oh-my-zsh/lib/history.zsh
找到

setopt inc_append_history
setopt share_history

修改成

unsetopt inc_append_history
unsetopt share_history

相关文章

网友评论

      本文标题:oh-my-zsh 安装使用

      本文链接:https://www.haomeiwen.com/subject/gyllaxtx.html