new NrrwRgn integration

This commit is contained in:
Christian Brabandt 2014-04-23 00:13:16 +02:00
parent 81430cbdf6
commit a90a39b4aa
3 changed files with 33 additions and 0 deletions

View File

@ -207,6 +207,10 @@ function! airline#extensions#load()
call airline#extensions#promptline#init(s:ext) call airline#extensions#promptline#init(s:ext)
endif endif
if get(g:, 'airline#extensions#nrrwrgn#enabled', 1) && exists(':NR') == 2
call airline#extensions#nrrwrgn#init(s:ext)
endif
if !get(g:, 'airline#extensions#disable_rtp_load', 0) if !get(g:, 'airline#extensions#disable_rtp_load', 0)
" load all other extensions, which are not part of the default distribution. " load all other extensions, which are not part of the default distribution.
" (autoload/airline/extensions/*.vim outside of our s:script_path). " (autoload/airline/extensions/*.vim outside of our s:script_path).

View File

@ -0,0 +1,24 @@
" MIT License. Copyright (c) 2013-2014 Bailey Ling.
" vim: et ts=2 sts=2 sw=2
if !get(g:, 'loaded_nrrw_rgn', 0)
finish
endif
function! airline#extensions#nrrwrgn#apply(...)
if exists(":WidenRegion") == 2
let spc = g:airline_symbols.space
call a:1.add_section('airline_a', printf('%s[Narrowed%s#%d]', spc, spc, b:nrrw_instn))
if exists('*airline#extensions#branch#get_head')
call a:1.add_section('airline_b', spc.'%{airline#extensions#branch#get_head()}'.spc)
endif
let bufname=(get(b:, 'orig_buf', 0) ? bufname(b:orig_buf) : substitute(bufname('%'), '^Nrrwrgn_\zs.*\ze_\d\+$', submatch(0), ''))
call a:1.add_section('airline_c', spc.bufname.spc)
call a:1.split()
return 1
endif
endfunction
function! airline#extensions#nrrwrgn#init(ext)
call a:ext.add_statusline_func('airline#extensions#nrrwrgn#apply')
endfunction

View File

@ -492,6 +492,11 @@ promptline <https://github.com/edkolev/promptline.vim>
let airline#extensions#promptline#color_template = 'visual' let airline#extensions#promptline#color_template = 'visual'
let airline#extensions#promptline#color_template = 'replace' let airline#extensions#promptline#color_template = 'replace'
< <
------------------------------------- *airline-nrrwrgn*
NrrwRgn <https://github.com/chrisbra/NrrwRgn>
* enable/disable NrrwRgn integration >
let g:airline#extensions#nrrwrgn#enabled = 1
============================================================================== ==============================================================================
ADVANCED CUSTOMIZATION *airline-advanced-customization* ADVANCED CUSTOMIZATION *airline-advanced-customization*