Linux 安裝並配置zsh


1. 安裝zsh,配置agnoster主題

1.1 安裝zsh

$ sudo apt-get install -y zsh

1.2 安裝oh-my-zsh

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

1.3 安裝powerline font字體庫

$ sudo apt-get install fonts-powerline

1.4 打開zsh配置文件 ~/.zshrc,修改主題為agnoster

1 # Set name of the theme to load --- if set to "random", it will
2 # load a random theme each time oh-my-zsh is loaded, in which case,
3 # to know which specific one was loaded, run: echo $RANDOM_THEME
4 # See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
5 ZSH_THEME="agnoster"

1.5 將zsh設置為默認終端

$ chsh -s `which zsh`

1.6 注銷,重新登陸

$ logout

 

2. 安裝插件

2.1 進入插件路徑

$ cd ~/.oh-my-zsh/plugins

2.2 下載自動補齊、高亮、建議插件

$ wget http://mimosa-pudica.net/src/incr-0.2.zsh
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git
$ git clone https://github.com/zsh-users/zsh-autosuggestions
$ source incr*.zsh

2.3 修改配置文件

$ vi ~/.zshrc
1 plugins=(git
2 zsh-syntax-highlighting
3 zsh-autosuggestions)
4 
5 source ~/.oh-my-zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

2.4 可能會出現的問題

2.4.1 compaudit | xargs chmod g-w,o-w
 1 [oh-my-zsh] Insecure completion-dependent directories detected:
 2 drwxrwxrwx   7 pi pi 640 12 16 09:03 /home/pi/.oh-my-zsh
 3 
 4 [oh-my-zsh] For safety, we will not load completions from these directories until
 5 [oh-my-zsh] you fix their permissions and ownership and restart zsh.
 6 [oh-my-zsh] See the above list for directories with group or other writability.
 7 
 8 [oh-my-zsh] To fix your permissions you can do so by disabling
 9 [oh-my-zsh] the write permission of "group" and "others" and making sure that the
10 [oh-my-zsh] owner of these directories is either root or your current user.
11 [oh-my-zsh] The following command may help:
12 [oh-my-zsh]     compaudit | xargs chmod g-w,o-w
13 
14 [oh-my-zsh] If the above didn't help or you want to skip the verification of
15 [oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
16 [oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

只需要按照提示,鍵入  compaudit | xargs chmod g-w,o-w

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM