Mac安装终端插件Oh my zsh

  1. 安装oh my zsh
  • 官网:http://ohmyz.sh

  • 安装方法

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

  • 安装完成后重启终端
  1. 主题配置
  • 进入当前用户目录

cd ~

  • 编辑zsh的总配置文件

vi .zshrc

  • 找到ZSH_THEME="robbyrussell",其中robbyrussell是要设定的主题名称,所有支持的主题可以在~/.oh-my-zsh/themes/下看到

  • ~/.oh-my-zsh/themes/下找到robbyrussell.zsh-theme文件,打开并进行编辑

##替换文件中的PROMPT部分为以下部分,来更换命令行中光标之前的目录文案和配色
PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p%{$fg[cyan]%}%d %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}>'
#PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}'
  1. 插件配置
  • 编辑zsh的总配置文件

vi .zshrc

  • 找到plugins=(),将想要开启的插件添加到括号内,保存即可。

下面是自己常用的插件
plugins=(git autojump osx mvn gradle brew node npm)

  1. 插件安装
  • 配合zsh的神奇插件autojump(官网)

  * 描述:一个快捷导航文件系统的工具

  * 安装,未安装homebrew的可以先安装homebrew(官网)

brew install autojump

  * 安装成功后,在zsh的总配置文件的最后一行添加如下命令

[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && . ~/.autojump/etc/profile.d/autojump.sh
  * 将autojump插件配置到zsh的插件中

  * 在命令行直接使用命令 j 目录名

  • zsh-autosuggestions:自动补全插件

  * Github: https://github.com/zsh-users/zsh-autosuggestions

你可能感兴趣的:(Mac安装终端插件Oh my zsh)