xkblayout: use FcitxCurrentIMwithRime() when available (#2670)

latest version of fcitx.vim add FcitxCurrentIMwithRime()
to display input method information in detail
This commit is contained in:
wzy
2024-04-25 05:11:48 +08:00
committed by GitHub
parent d9f42cb467
commit ff0f9a45a5

View File

@@ -12,8 +12,13 @@ function! airline#extensions#xkblayout#status()
let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '') let keyboard_layout = libcall(g:XkbSwitchLib, 'Xkb_Switch_getXkbLayout', '')
let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '') let keyboard_layout = get(split(keyboard_layout, '\.'), -1, '')
else else
if exists('*FcitxCurrentIMwithRime')
let keyboard_layout = FcitxCurrentIMwithRime()
else
let keyboard_layout = FcitxCurrentIM()
endif
" substitute keyboard-us to us " substitute keyboard-us to us
let keyboard_layout = substitute(FcitxCurrentIM(), 'keyboard-', '', 'g') let keyboard_layout = substitute(keyboard_layout, 'keyboard-', '', 'g')
endif endif
let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'}) let short_codes = get(g:, 'airline#extensions#xkblayout#short_codes', {'2SetKorean': 'KR', 'Chinese': 'CN', 'Japanese': 'JP'})