Open mario-amazing opened 1 year ago
How do you expect it to work? Keymap assistance won't switch system keyboard layout. Instead, it relies on builtin Vim's iminsert
and imsearch
attributes. So, when you returned from Insert mode with, say, Russian keyboard layout, typing fg
will actually find letter п
. I use dynamic keymap assistance with the following config:
let g:XkbSwitchAssistNKeymap = 1 " for commands r and f
let g:XkbSwitchDynamicKeymap = 1
let g:XkbSwitchKeymapNames =
\ {'ru' : 'russian-jcukenwin', 'de' : 'german-qwertz'}
" quickly toggle keyboard layout for f and r commands in normal mode
" (<C-^> also switches keyboard layout in search mode)
let g:XkbSwitchIminsertToggleKey = '<C-^>'
let g:XkbSwitchIminsertToggleEcho = 0
It works for me. Notice that there is mapping <C-^>
for switching Keymap assistance related keyboard layout in Normal mode. Note that dynamic assistance requires setting of g:XkbSwitchKeymapNames
. I also checked the simple (static) config you showed, and it worked as well.
As to XkbSwitchAssistSKeymap
, it is not actually working any more (and therefore is deprecated), because now search in the command line obeys the normal keyboard layout switching flow which unites the search mode with the Insert and Select modes.
IMHO expected behaiviour the same as you described above. But when I press fg
(with previous Russian language), vim tried to find g
letter.
I have tried your proposal with lua config, but have the same result:
-- vim-xkbswitch
vim.g.XkbSwitchLib = '/usr/local/bin/libxkbswitch.dylib'
vim.g.XkbSwitchEnabled = 1
vim.g.XkbSwitchIMappings = { 'ru' }
vim.g.XkbSwitchAssistNKeymap = 1 -- for commands r and f
vim.g.XkbSwitchDynamicKeymap = 1
vim.g.XkbSwitchKeymapNames = {['ru'] = 'russian-jcukenwin', ['uk'] = 'ukrainian-jcuken'}
vim.g.XkbSwitchIminsertToggleEcho = 0
After you return from Insert mode with Russian layout to Normal mode, what command
:echo b:xkb_layout
says? Does it say ru
?
E121: Undefined variable: b:xkb_layout
I made a typo, I meant b:xkb_ilayout
:echo b:xkb_ilayout: 1
when English 3
Values 1
and 3
are rather weird: they are keyboard layout names and therefore should normally be like us
and ru
. But if you really have such names, then use dynamic keymap assistance with
let g:XkbSwitchKeymapNames = {'1' : 'russian-jcukenwin'}
Still the same behavior
r
andf
commands not working with configuration from readme:XkbSwitchAssistNKeymap -> not working XkbSwitchAssistSKeymap -> working, but have deprecation messages when vim started
tried with:
and