安装 Zsh 及 Oh-my-zsh


详细介绍就略过吧,能够参考这篇文章:使用ZSH的九个理由node

下面记录一下我在配置ZSH的过程当中的要点:linux

一、基本上你能找到的配置教程都是基于oh-my-zsh的。

由于zsh配置过于复杂,因此有了oh-my-zsh这个项目,目的在于简化zsh配置。项目地址:https://github.com/robbyrussell/oh-my-zshgit

在项目readme文档中详细介绍了使用方法,这里略过。github

 二、使用oh-my-zsh的前提是你已经安装好了zsh。

oh-my-zsh其实就是一堆zsh脚本的集合,zsh原程序仍是须要独立安装的。各个平台的方法不一样,再也不赘述。web

三、readme文档中提供的手动安装方法以下

 

四、基本配置(以个人.zshrc为例)

五、下面是其余一些有用的配置

 六、zsh中grep搜索结果中的关键字没有红色高亮

在文件 oh-my-zsh/lib/grep.zsh中,有export GREP_COLOR=’1;32′shell

若要恢复grep默认红色的设置,要么删除那行代码,要么在.zshrc中 export GREP_COLOR=” 从新赋为空值npm


在 Ubuntu Linux 中安裝 Zsh 及 Oh-my-zsh
直接用 apt-get 安裝 zsh 套件
$ apt-get install zsh
$ zsh --verison

從 GitHub 下載 oh-my-zsh 套件
$ git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

若是本來沒有安裝 zsh 能够直接使用 oh-my-zsh 的範例 zshrc
$ cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

看看有什麼 Theme 能够用
$ ls ~/.oh-my-zsh/themes

編輯 ~/.zshrc 更換 zsh 的 theme 我本身喜歡用 candy
ZSH_THEME="candy"

看看有什麼 Plugin 能够用
$ ls ~/.oh-my-zsh/plugins

編輯 ~/.zshrc 啟用 Plugin
plugins=(git git-flow debian grails rvm history-substring-search github gradle svn node npm zsh-syntax-highlighting sublime)

下載 zsh-syntax-highlighting plugin
$ cd ~/.oh-my-zsh/custom/plugins
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git

新增自訂 zsh 設定,我會把 alias 和 PATH 的設定放在這邊
$ cat ~/.oh-my-zsh/custom/xxx.zsh
alias df='df -h'
alias h='htop'
PATH=$PATH:/opt/app/bin/


 

相关文章
相关标签/搜索