安裝 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/


 

相關文章
相關標籤/搜索