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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

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