網頁

2019年1月21日 星期一

Ubuntu 18.04終端機優化

有用過MacOSX都知道Oh My ZSH+iterm2優化終端機功能是多麼的強大,以下要介紹ubuntu18.04系統如何優化終端機,雖然無法在ubuntu安裝iterm2,但還是有其他套件可以取代MacOSX的iterm2喔。

1.安裝ZSH Shell
$ sudo apt-get install zsh

默認Shell為zsh
$ chsh -s /bin/zsh (不要用sudo)

配置密碼文件,解決chsh: PAM認證失敗的問題
$ sudo vim /etc/passwd

ZSH 設置為當前登錄用戶
$ sudo usermod -s /usr/bin/zsh $(whoami)

2.ZSH安裝Powerline和Powerline字體
$ sudo apt install powerline fonts-powerline

安裝ZSH Powerlevel9k美化主題 (Powerlevel9k是目前比較紅的主題)
$ sudo apt install zsh-theme-powerlevel9k

啟動主題 (重開終端機就會產生主題)
$ echo "source /usr/share/powerlevel9k/powerlevel9k.zsh-theme" >> ~/.zshrc
3.ZSH Shell上啟用語法高亮顯示
$ sudo apt install zsh-syntax-highlighting
$ echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
4.安裝 Oh My ZSH
$ sudo apt install git
$ sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

更改 Oh My ZSH 主題agnoster
$ vi ~/.zshrc
註解powerlevel9k (會衝突)
#source /usr/share/powerlevel9k/powerlevel9k.zsh-theme
ZSH_THEME="agnoster"

參考
http://ohmyz.sh/

5.安裝autojump
$ sudo apt-get install autojump
$ source /usr/share/autojump/autojump.sh on startup
$ echo '. /usr/share/autojump/autojump.sh'>>~/.zshrc
   echo '. /usr/share/autojump/autojump.sh'>>~/.bashrc (沒裝zsh)

參考
https://www.linuxidc.com/Linux/2015-08/121421.htm
https://github.com/wting/autojump

6.安裝zsh-autosuggestions語法歷史記錄插件
$ git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
$ vim ~/.zshrc
修改plugins=(zsh-autosuggestions)


最後一行加上
source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
 
$ source $ZSH_CUSTOM/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
$ source ~/.zshrc

參考
https://www.cnblogs.com/EasonJim/p/7863099.html
https://github.com/zsh-users/zsh-autosuggestions




若要在zsh執行lammps
$ vim ~/.zshrc
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
$ source ~/.zshrc

沒有留言:

張貼留言