diff --git a/autoload/airline/extensions/keymap.vim b/autoload/airline/extensions/keymap.vim index 957b97d4..7e41669e 100644 --- a/autoload/airline/extensions/keymap.vim +++ b/autoload/airline/extensions/keymap.vim @@ -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 diff --git a/doc/airline.txt b/doc/airline.txt index 355fe340..dd6fef12 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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 (despite its name, it can be used for Vim and Neovim).