Vim插件之vim-airline

vim-airline,状态栏美化插件,使用前请确保已经在vimrc中写入

set laststatus=2

初次安装以后打开Vim,会发现状态栏会出现乱码,这时有两种解决方案,一种是安装powerline字体或者Nerd Fonts实现字体显示,另一种是用unicode字符替代,对于第一种方案,字体的安装请参考github相应主页上的说明,安装完字体以后配置如下

"airline
"安装字体后必须设置
let g:airline_powerline_fonts = 1
"开启tabline
let g:airline#extensions#tabline#enabled = 1
let g:airline#extensions#tabline#buffer_nr_show = 1
if !exists('g:airline_symbols')
  let g:airline_symbols = {}
endif
"powerline symbols
let g:airline_left_sep = ''
let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let g:airline_symbols.branch = ''
let g:airline_symbols.readonly = '⭤'
let g:airline_symbols.linenr = ''

上面powerline symbols中的字体有些可能在文章中显示不出来,你可以在终端中执行

$ vim ~/.vim/bundle/vim-airline/doc/airline.txt

拷贝从if !exists(‘g:airline_symbols’)开始到”old vim-powerline symbols间的字符到vimrc中
对于第二种方案,最后配置如下

"airline
"安装字体后必须设置
let g:airline_powerline_fonts = 1
"关闭tabline
let g:airline#extensions#tabline#enabled = 0
let g:airline#extensions#tabline#buffer_nr_show = 1
if !exists('g:airline_symbols')
  let g:airline_symbols = {}
endif
"unicode symbols
let g:airline_left_sep = '▶'
let g:airline_left_alt_sep = '❯'
let g:airline_right_sep = '◀'
let g:airline_right_alt_sep = '❮'
let g:airline_symbols.linenr = '¶'
let g:airline_symbols.branch = '⎇'

显然,使用第二种方案省去了安装powerline字体这一步,更加简单而且兼容性也更好

你可能感兴趣的:(Vim)