extract iminsert out of core into an extension
This commit is contained in:
parent
52a4a8ea7b
commit
384150ecd7
@ -163,20 +163,12 @@ function! airline#update_highlight()
|
|||||||
let l:mode = ['insert']
|
let l:mode = ['insert']
|
||||||
elseif l:m ==# "R"
|
elseif l:m ==# "R"
|
||||||
let l:mode = ['replace']
|
let l:mode = ['replace']
|
||||||
elseif l:m =~# '\v(v|V|)'
|
elseif l:m =~# '\v(v|V||s|S|)'
|
||||||
let l:mode = ['visual']
|
|
||||||
elseif l:m =~# '\v(s|S|)'
|
|
||||||
let l:mode = ['visual']
|
let l:mode = ['visual']
|
||||||
else
|
else
|
||||||
let l:mode = ['normal']
|
let l:mode = ['normal']
|
||||||
endif
|
endif
|
||||||
let g:airline_current_mode_text = get(g:airline_mode_map, l:m, l:m)
|
let g:airline_current_mode_text = get(g:airline_mode_map, l:m, l:m)
|
||||||
if g:airline_detect_iminsert && &iminsert
|
|
||||||
if get(g:, 'airline_powerline_fonts', 0)
|
|
||||||
let g:airline_current_mode_text .= ' '.g:airline_left_alt_sep
|
|
||||||
endif
|
|
||||||
let g:airline_current_mode_text .= ' '.toupper(get(b:, 'keymap_name', 'lang'))
|
|
||||||
endif
|
|
||||||
else
|
else
|
||||||
let l:mode = ['inactive']
|
let l:mode = ['inactive']
|
||||||
endif
|
endif
|
||||||
|
@ -139,6 +139,10 @@ function! airline#extensions#load()
|
|||||||
call airline#extensions#whitespace#init()
|
call airline#extensions#whitespace#init()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if g:airline_detect_iminsert
|
||||||
|
call airline#extensions#iminsert#init()
|
||||||
|
endif
|
||||||
|
|
||||||
call airline#exec_funcrefs(g:airline_statusline_funcrefs, 0)
|
call airline#exec_funcrefs(g:airline_statusline_funcrefs, 0)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
14
autoload/airline/extensions/iminsert.vim
Normal file
14
autoload/airline/extensions/iminsert.vim
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
" MIT license. Copyright (c) 2013 Bailey Ling.
|
||||||
|
" vim: ts=2 sts=2 sw=2 fdm=indent
|
||||||
|
|
||||||
|
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
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user