I have a below line

set keymap = russian-jcukenwin.vim

in .vimrc.

When I press C-^ I get indicator in mode line , like INSERT (RU).

I'd like to output it in lightline vim config, and there is %k flag for this, but is there a different way to get the current value?

When I try below (to call it in lightline configuration)

function! CurrentKeymap() abort
    let l:current = toupper(b:keymap_name)
    return l:current

it always returns RU - even if keymap is not activated (with C-^)

1 Answer 1


There is also :h iminsert you can use to check if keymap is active:

function! CurrentKeymap() abort
    return &iminsert ? toupper(b:keymap_name) : ""

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.