[add#keymap] more customization
Added more customization for keymap extension
This commit is contained in:
parent
44b7b72938
commit
193460137a
|
@ -9,7 +9,18 @@ endif
|
|||
|
||||
function! airline#extensions#keymap#status()
|
||||
if (get(g:, 'airline#extensions#keymap#enabled', 1) && has('keymap'))
|
||||
return printf('%s', (!empty(&keymap) && &iminsert ? (g:airline_symbols.keymap . ' '. &keymap) : ''))
|
||||
let short_codes = get(g:, 'airline#extensions#keymap#short_codes')
|
||||
let label = get(g:, 'airline#extensions#keymap#label', g:airline_symbols.keymap)
|
||||
let default = get(g:, 'airline#extensions#keymap#default', '')
|
||||
if (label !=# '')
|
||||
let label .= ' '
|
||||
endif
|
||||
let keymap = &keymap
|
||||
if has_key(short_codes, keymap)
|
||||
let keymap = short_codes[keymap]
|
||||
endif
|
||||
return printf('%s', (!empty(keymap) && &iminsert ? (label . keymap) :
|
||||
\ (!empty(default) ? label . default : default)))
|
||||
else
|
||||
return ''
|
||||
endif
|
||||
|
|
|
@ -826,6 +826,15 @@ This extension displays the current 'keymap' in use.
|
|||
* enable/disable vim-keymap extension >
|
||||
let g:airline#extensions#keymap#enabled = 1
|
||||
|
||||
* set label for a keymap (default is from g:airline_symbols.keymap) >
|
||||
let g:airline#extensions#keymap#label = 'Layout:'
|
||||
|
||||
* set name for default lauout (empty to disable it completely) >
|
||||
let g:airline#extensions#keymap#default = ''
|
||||
|
||||
* set short codes for layout names >
|
||||
let g:airline#extensions#keymap#short_codes = {'russian-jcukenwin': 'ru'}
|
||||
|
||||
------------------------------------- *airline-languageclient*
|
||||
LanguageClient <https://github.com/autozimu/LanguageClient-neovim>
|
||||
(despite its name, it can be used for Vim and Neovim).
|
||||
|
|
Loading…
Reference in New Issue