Fix bug of keyboard_layout

when `keyboard_layout==''`, `let keyboard_layout = split(keyboard_layout, '\.')[-1]` will return an error.
This commit is contained in:
wzy 2020-06-29 13:44:13 +08:00 committed by GitHub
parent d0aaa061c2
commit b96e02c649
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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