美文网首页
zsh [oh my zsh]

zsh [oh my zsh]

作者: 弥宣 | 来源:发表于2017-12-07 01:06 被阅读15次

作者 :Otway
版权 :转载请注明出处!

安装


  git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# Backup your existing ~/.zshrc file:  optional
  cp ~/.zshrc ~/.zshrc.orig
# Recommend
  cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
  source ~/.zshrc
# Change your default shell
  chsh -s /bin/zsh

主题配置


采用的是powerlevel9k主题,色系是Neutron

以下是安装 powerline 以及解决字体乱码问题

  pip install --user powerline-status

# Download fonts and font config.
  wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf
  wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf

# Linux
  mv PowerlineSymbols.otf ~/.fonts/
# Update font cache for the path the font was moved to.
  fc-cache -vf ~/.fonts/
# Install the fontconfig file.
  mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/

# Mac OS X
# You can click the PowerlineSymbols.otf to install or you can move the file to font dir like: 
  mv PowerlineSymbols.otf /Library/Fonts/

字体安装完毕之后,需要:

配置色系

  • Launch iTerm 2. Get the latest version at iterm2.com
  • Type CMD+i (⌘+i)
  • Navigate to Colors tab
  • Click on Load Presets
  • Click on Import
  • Save the neutron.itermcolors file
  • Click on Load Presets and choose neutron

配置字体

  • Navigate to Text tab
  • Click Change Font
  • Search PowerlineSymbols and select to use

样式配置(在~/.zshrc中添加):

POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status time)
POWERLEVEL9K_TIME_FORMAT="%D{%H:%M:%S}"
POWERLEVEL9K_NODE_VERSION_BACKGROUND='022'
POWERLEVEL9K_SHORTEN_DIR_LENGTH=1

更多可参看: 主题色系

ps: 由于 git 是默认安装的插件,而且 ~/.zshrc 中是默认的高亮,满足了基本使用。如果需要安装插件,请自行 google 。刚接触的时候,迷恋插件,然后找到 Github 上的脚本安装,将 Vim 打造成了炫酷的 IDE 效果,由于不熟悉操作,放弃之,自此远离非必要插件,需求驱动安装插件我觉得是新手最佳选择。

相关文章

网友评论

      本文标题:zsh [oh my zsh]

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