xkblayout: Make Short codes configurable

airline#extensions#xkblayout#short_codes changed to global for easily redefine long named keyboard layout

closes #1713
This commit is contained in:
Stanislav Gobunov 2018-04-18 10:13:24 +03:00 committed by Christian Brabandt
parent 3ad4a18d85
commit c4a4a20b8d
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 10 additions and 1 deletions

View File

@ -10,7 +10,7 @@ endif
function! airline#extensions#xkblayout#status()
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
let keyboard_layout = split(keyboard_layout, '\.')[-1]
let short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})
if has_key(short_codes, keyboard_layout)
let keyboard_layout = short_codes[keyboard_layout]

View File

@ -999,6 +999,15 @@ vim-xkblayout
* enable/disable vim-xkblayout extension >
let g:airline#extensions#xkblayout#enabled = 1
* redefine keyboard layout short codes to shown in status >
let g:airline#extensions#xkblayout#short_codes = {'Russian-Phonetic': 'RU', 'ABC': 'EN'}
<
'RU' instead of system 'Russian-Phonetic',
'EN' instead of system 'ABC'.
Default: >
let g:airline#extensions#xkblayout#short_codes = {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}
* define path to the backend switcher library
Linux (Install https://github.com/ierton/xkb-switch): >
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so'