diff --git a/autoload/airline/extensions.vim b/autoload/airline/extensions.vim index 7aa6c172..1ad7d92a 100644 --- a/autoload/airline/extensions.vim +++ b/autoload/airline/extensions.vim @@ -199,10 +199,6 @@ function! airline#extensions#load() call airline#extensions#readonly#init() endif - if get(g:, 'airline#extensions#iminsert#enabled', 0) || get(g:, 'airline_detect_iminsert', 0) - call airline#extensions#iminsert#init() - endif - " load all other extensions not part of the default distribution for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") " check to see that both the resolved and unresolved paths do not match diff --git a/autoload/airline/extensions/iminsert.vim b/autoload/airline/extensions/iminsert.vim deleted file mode 100644 index 9371016a..00000000 --- a/autoload/airline/extensions/iminsert.vim +++ /dev/null @@ -1,14 +0,0 @@ -" MIT License. Copyright (c) 2013 Bailey Ling. -" vim: et ts=2 sts=2 sw=2 - -function! airline#extensions#iminsert#get_text() - if &iminsert - return toupper(get(b:, 'keymap_name', 'lang')) - endif - return '' -endfunction - -function! airline#extensions#iminsert#init() - let g:airline_section_a .= ' '.g:airline_left_alt_sep.' %{airline#extensions#iminsert#get_text()}' -endfunction - diff --git a/autoload/airline/fragments.vim b/autoload/airline/fragments.vim index 89f07972..aa25f9f6 100644 --- a/autoload/airline/fragments.vim +++ b/autoload/airline/fragments.vim @@ -7,6 +7,13 @@ call extend(g:airline#fragments#symbols, { \ }, 'keep') function! airline#fragments#get_paste() - return &paste ? ' ' . g:airline#fragments#symbols.paste : '' + return g:airline_detect_paste && &paste ? ' '.g:airline#fragments#symbols.paste : '' +endfunction + +function! airline#fragments#get_iminsert() + if g:airline_detect_iminsert && &iminsert && exists('b:keymap_name') + return ' '.g:airline_left_alt_sep.' '.toupper(b:keymap_name) + endif + return '' endfunction diff --git a/doc/airline.txt b/doc/airline.txt index 900a7785..93f7a116 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -46,8 +46,11 @@ values): * enable modified detection > let g:airline_detect_modified=1 +* enable paste detection > + let g:airline_detect_paste=1 +< * enable iminsert detection > - let g:airline_detect_iminsert=1 + let g:airline_detect_iminsert=0 < * determine whether inactive windows should have the left section collapsed to only the filename of that buffer. > diff --git a/plugin/airline.vim b/plugin/airline.vim index f75107bc..0329aaa7 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -22,6 +22,7 @@ call s:check_defined('g:airline_right_sep', get(g:, 'airline_powerline_fonts', 0 call s:check_defined('g:airline_right_alt_sep', get(g:, 'airline_powerline_fonts', 0)?"":"<") call s:check_defined('g:airline_detect_modified', 1) call s:check_defined('g:airline_detect_paste', 1) +call s:check_defined('g:airline_detect_iminsert', 0) call s:check_defined('g:airline_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0)?' ':':') call s:check_defined('g:airline_inactive_collapse', 1) call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) @@ -49,7 +50,7 @@ call s:check_defined('g:airline_theme_map', { \ '.*solarized.*': 'solarized', \ }) -call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}%{airline#fragments#get_paste()}') +call s:check_defined('g:airline_section_a', '%{get(w:, "airline_current_mode", "")}%{airline#fragments#get_paste()}%{airline#fragments#get_iminsert()}') call s:check_defined('g:airline_section_b', '') call s:check_defined('g:airline_section_c', '%f%m') call s:check_defined('g:airline_section_gutter', '%=')