convert iminsert into a fragment.

This commit is contained in:
Bailey Ling 2013-08-26 23:07:14 -04:00
parent e919663781
commit fe24924ad3
5 changed files with 14 additions and 21 deletions

View File

@ -199,10 +199,6 @@ function! airline#extensions#load()
call airline#extensions#readonly#init() call airline#extensions#readonly#init()
endif 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 " load all other extensions not part of the default distribution
for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n") for file in split(globpath(&rtp, "autoload/airline/extensions/*.vim"), "\n")
" check to see that both the resolved and unresolved paths do not match " check to see that both the resolved and unresolved paths do not match

View File

@ -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

View File

@ -7,6 +7,13 @@ call extend(g:airline#fragments#symbols, {
\ }, 'keep') \ }, 'keep')
function! airline#fragments#get_paste() 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 endfunction

View File

@ -46,8 +46,11 @@ values):
* enable modified detection > * enable modified detection >
let g:airline_detect_modified=1 let g:airline_detect_modified=1
* enable paste detection >
let g:airline_detect_paste=1
<
* enable iminsert detection > * 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 * determine whether inactive windows should have the left section collapsed to
only the filename of that buffer. > only the filename of that buffer. >

View File

@ -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_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_modified', 1)
call s:check_defined('g:airline_detect_paste', 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_linecolumn_prefix', get(g:, 'airline_powerline_fonts', 0)?' ':':')
call s:check_defined('g:airline_inactive_collapse', 1) call s:check_defined('g:airline_inactive_collapse', 1)
call s:check_defined('g:airline_exclude_filenames', ['DebuggerWatch','DebuggerStack','DebuggerStatus']) 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', \ '.*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_b', '')
call s:check_defined('g:airline_section_c', '%f%m') call s:check_defined('g:airline_section_c', '%f%m')
call s:check_defined('g:airline_section_gutter', '%=') call s:check_defined('g:airline_section_gutter', '%=')