diff --git a/autoload/airline.vim b/autoload/airline.vim index 4d1eb78..5d09e47 100644 --- a/autoload/airline.vim +++ b/autoload/airline.vim @@ -96,6 +96,10 @@ function! s:invoke_funcrefs(context, funcrefs) endfunction function! airline#statusline(winnr) + return '%{airline#check_mode()}'.s:contexts[a:winnr].line +endfunction + +function! airline#check_mode() if get(w:, 'airline_active', 1) let l:m = mode() if l:m ==# "i" @@ -126,6 +130,6 @@ function! airline#statusline(winnr) let w:airline_lastmode = mode_string endif - return s:contexts[a:winnr].line + return '' endfunction diff --git a/t/airline.vim b/t/airline.vim index b523d43..c613ad3 100644 --- a/t/airline.vim +++ b/t/airline.vim @@ -79,5 +79,9 @@ describe 'airline' Expect getwinvar(2, '&statusline') != 'airline#parts#mode' wincmd c end + + it 'should include check_mode' + Expect airline#statusline(1) =~ 'airline#check_mode' + end end