让BASH,VIM美美的Powerline

前言

 鉴于BASH及其周边强大的工具以及VIM高效快捷,加上如今我工做重心转移到前端开发上,所以我华丽地转向Linux阵营(固然从最傻瓜式的Ubuntu开始啦!)。但BASH和VIM默认样式确实颜值过低,功能强大当然重要,但在这看脸的时代谁不爱漂亮呢?那么咱们先拿状态栏来开刀吧,而刀就是强大酷炫的Powerline本尊了。html

Powerline是什么?

 Powerline是个stateless status line,便可以配置到BASH,ZSH,VIM等上,而不像vim-powerline那样仅能用于vim.前端

安装Powerline

1.先保证python版本在2.7+python

$ python --version

2.安装pip,并经过pip安装powerlinelinux

$ sudo apt install pip
$ pip install powerline-status

安装/配置字体

 提及样式怎能少了字体呢?并且Powerline中还用到特殊的字符,须要特定的字体来配合才能达到最佳显示效果。git

$ git clone https://github.com/powerline/fonts &&
./fonts/install.sh

而后到Profiles -> Profile Preferences选择合适的xxx for powerline的字体便可。github

Powerline 4 BASH

 安装好powerline后,就是配置.bashrc了。vim

$ 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》。而后windows

$ 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

总结

最终的效果为:
bash

 尊重原创,转载请注明来自:http://www.cnblogs.com/fsjohnhuang/p/6057013.html^_^肥仔Johnless

感谢

为Bash和VIM配置一个美观奢华的状态提示栏

相关文章
相关标签/搜索