From d6475684b7fbc300bd26994872fb8ea0b88c5468 Mon Sep 17 00:00:00 2001 From: Wes Malone Date: Thu, 4 Sep 2014 22:02:19 -0500 Subject: [PATCH] add windowswap extension --- autoload/airline/extensions.vim | 4 ++++ autoload/airline/extensions/windowswap.vim | 23 ++++++++++++++++++++++ autoload/airline/init.vim | 4 ++-- doc/airline.txt | 9 +++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 autoload/airline/extensions/windowswap.vim diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 6456073..1738f62 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -215,6 +215,10 @@ function! airline#extensions#load() call airline#extensions#capslock#init(s:ext) endif + if (get(g:, 'airline#extensions#windowswap#enabled', 1) && get(g:, 'loaded_windowswap', 0)) + call airline#extensions#windowswap#init(s:ext) + endif + if !get(g:, 'airline#extensions#disable_rtp_load', 0) " load all other extensions, which are not part of the default distribution. " (autoload/airline/extensions/*.vim outside of our s:script_path). diff --git a/autoload/airline/extensions/windowswap.vim b/autoload/airline/extensions/windowswap.vim new file mode 100644 index 0000000..2beb91c --- /dev/null +++ b/autoload/airline/extensions/windowswap.vim @@ -0,0 +1,23 @@ +" vim: et ts=2 sts=2 sw=2 + +if !exists('g:loaded_windowswap') + finish +endif + +let s:spc = g:airline_symbols.space + +if !exists('g:airline#extensions#windowswap#indicator_text') + let g:airline#extensions#windowswap#indicator_text = 'WS' +endif + +function! airline#extensions#windowswap#init(ext) + call airline#parts#define_function('windowswap', 'airline#extensions#windowswap#get_status') +endfunction + +function! airline#extensions#windowswap#get_status() + if WindowSwap#HasMarkedWindow() && WindowSwap#GetMarkedWindowNum() == winnr() + return g:airline#extensions#windowswap#indicator_text.s:spc + endif + return '' +endfunction + diff --git a/autoload/airline/init.vim b/autoload/airline/init.vim index 539f2c4..021b3b2 100644 --- a/autoload/airline/init.vim +++ b/autoload/airline/init.vim @@ -78,7 +78,7 @@ function! airline#init#bootstrap() call airline#parts#define_raw('file', '%f%m') call airline#parts#define_raw('linenr', '%{g:airline_symbols.linenr}%#__accent_bold#%4l%#__restore__#') call airline#parts#define_function('ffenc', 'airline#parts#ffenc') - call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace']) + call airline#parts#define_empty(['hunks', 'branch', 'tagbar', 'syntastic', 'eclim', 'whitespace','windowswap']) call airline#parts#define_text('capslock', '') unlet g:airline#init#bootstrapping @@ -105,7 +105,7 @@ function! airline#init#sections() let g:airline_section_y = airline#section#create_right(['ffenc']) endif if !exists('g:airline_section_z') - let g:airline_section_z = airline#section#create(['%3p%%'.spc, 'linenr', ':%3c ']) + let g:airline_section_z = airline#section#create(['windowswap', '%3p%%'.spc, 'linenr', ':%3c ']) endif if !exists('g:airline_section_warning') let g:airline_section_warning = airline#section#create(['syntastic', 'eclim', 'whitespace']) diff --git a/doc/airline.txt b/doc/airline.txt index 0864218..abdeae1 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -510,6 +510,15 @@ vim-capslock * enable/disable vim-capslock integration > let g:airline#extensions#capslock#enabled = 1 + +------------------------------------- *airline-windowswap* +vim-windowswap + +* enable/disable vim-windowswap integration > + let g:airline#extensions#windowswap#enabled = 1 + +* set marked window indicator string > + let g:airline#extensions#windowswap#indicator_text = 'WS' < ============================================================================== ADVANCED CUSTOMIZATION *airline-advanced-customization*