文章出處
文章列表
前言
鑒于BASH及其周邊強大的工具以及VIM高效快捷,加上現在我工作重心轉移到前端開發上,因此我華麗地轉向Linux陣營(當然從最傻瓜式的Ubuntu開始啦!)。但BASH和VIM默認樣式確實顏值太低,功能強大固然重要,但在這看臉的時代誰不愛美呢?那么我們先拿狀態欄來開刀吧,而刀就是強大酷炫的Powerline本尊了。
Powerline是什么?
Powerline是個stateless status line,即可以配置到BASH,ZSH,VIM等上,而不像vim-powerline那樣僅能用于vim.
安裝Powerline
1.先保證python版本在2.7+
$ python --version
2.安裝pip,并通過pip安裝powerline
$ sudo apt install pip
$ pip install powerline-status
安裝/配置字體
說起樣式怎能少了字體呢?而且Powerline中還用到特殊的字符,需要特定的字體來配合才能達到最佳顯示效果。
$ git clone https://github.com/powerline/fonts &&
./fonts/install.sh
然后到Profiles
-> Profile Preferences
選擇合適的xxx for powerline的字體即可。
Powerline 4 BASH
安裝好powerline后,就是配置.bashrc
了。
$ cat >> .bashrc << EOF
source $(pip show powerline-status | awk '/Location:/{print $2 "/powerline/bindings/bash/powerline.sh"}')
EOF
Powerline 4 VIM
相對BASH,將Powerline配置到VIM會復雜一些。首先要準備一個支持Python2的VIM,具體操作請參考《讓VIM支持Python2 by update-alternatives》。然后
$ cat >> .vimrc << EOF
set rtp+=$(pip show powerline-status | awk '/Location:/{print $2 "/powerline/bindings/vim"}')
" These lines setup the environment to show graphics and colors correctly.
set nocompatible
set t_Co=256
let g:minBufExplForceSyntaxEnable = 1
python from powerline.vim import setup as powerline_setup
python powerline_setup()
python del powerline_setup
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
set laststatus=2 " Always display the statusline in all windows
set guifont=Inconsolata\ for\ Powerline:h14
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline)
EOF
總結
最終的效果為:
尊重原創,轉載請注明來自:http://www.cnblogs.com/fsjohnhuang/p/6057013.html^_^肥仔John
感謝
文章列表
全站熱搜