zsh
是一大終端利器, 什麼?你還不知道?
不僅是樣式而且在自動補全等等功能完爆bash,誰用誰知道!
如何在一個沒有root環境的賬戶下配置呢? 這時候就要我們自己編譯zsh了
參考:
- 安裝zsh
首先從sourceforge下載zsh
wget -O zsh.tar.gz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && tar -xvf zsh.tar.gz -C zsh --strip-components 1
cd zsh
# 配置,比如將Zsh安裝到~下
./configure --prefix=$HOME
make
make install
網上給的解壓的部分多爲tar -xvzf zsh.tar.gz
但實際上我用的時候提示文件並沒有被壓縮, 所以我去掉了z
我這裏將它直接安裝到了~文件夾下, 安裝過後home文件夾出現了
share
和bin
文件夾,然後運行zsh
有反應, 說明安裝成功了
還是推薦安裝到$HOME/usr
目錄下
- 安裝oh-my-zsh
克隆oh-my-zsh
到本地, 手動執行
wget --no-check-certificate https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
bash install.sh
- 出現問題
並沒有出現網上所說的, 安裝完oh-my-zsh
出現相關字樣. 反倒是在運行zsh
的時候, 出現:
/public/liangy/.oh-my-zsh/lib/theme-and-appearance.zsh:2: colors: function definition file not found
/public/liangy/.oh-my-zsh/oh-my-zsh.sh:76: compinit: function definition file not found
/public/liangy/.oh-my-zsh/plugins/git/git.plugin.zsh:83: command not found: compdef
/public/liangy/.oh-my-zsh/plugins/git/git.plugin.zsh:98: command not found: compdef
...
這是因爲oh-my-zsh
沒有找到我們的zsh
,所以我們需要手動指定
- 修改oh-my-zsh配置
參考
github
的issue
https://github.com/robbyrussell/oh-my-zsh/issues/4607
Addexport FPATH=$HOME/usr/share/zsh/'version of zsh'/functions:$FPATH
in your.zshrc
這裏, 我們只需要稍作修改
export FPATH=$HOME/share/zsh/'version of zsh'/functions:$FPATH
因爲我們的zsh源碼位於~/share/zsh
裏, 所以這一步與其他不同
配置成功