lyokha / vim-xkbswitch Goto Github PK
View Code? Open in Web Editor NEWvim plugin for automatic keyboard layout switching in insert mode
License: MIT License
vim plugin for automatic keyboard layout switching in insert mode
License: MIT License
Began using i3wm, configured switching keyboard layout with this i3 config:
exec --no-startup-id setxkbmap -layout us,ru
exec --no-startup-id setxkbmap -option 'grp:shifts_toggle'
If I get this correctly, each time i3 starts those two setxkbmap
commands are executed. Except now vim-xkbswitch does not switch keyboard layout while changing modes. I understand everything that contains xkb in it very poorly. Where can I look for help? Maybe there are solutions for aligning i3wm and xkbswitch?
Не могу напечтать эти символы, вместо них печатаются квадратные скобки.
Vim 7.4, ubuntu 13.10
The XkbSwitchIMappings appears to ignore existing insert-mode mappings with Meta (Alt). I'm not sure there's a way to fix this though: I have not been able to get cyrillic meta mappings to work at all, neither in normal nor in insert.
Oh this of course only applies to console vim with terminal configured to send for alt-combos as per ECMA-35, which is needed if you want to use Unicode. I have no idea how the plugin works with regular, 8th-bit meta (do you want me to test?)
Hi.
I am using vim 8 under windows 10.
Here is my config:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchIMappings = ['ru']
let g:XkbSwitchIMappingsSkipFt = ['tex']
let g:XkbSwitchNLayout = 'US'
let g:XkbSwitchILayout = 'US'
When I am starting vim I constantly see this error message, duplicated many times.
...
No mappings found
No mappings found
No mappings found
No mappings found
...
Could you, pls, tell me how to avoid this?
Пишу в инсерт моде текст на русском, выхожу в нормал мод - расскладка остаётся русской.
Настройки:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/lib/libxkbswitch.so'
let g:XkbSwitchILayout = 'ru'
let g:XkbSwitchNLayout = 'us'
libxkbswitch.so с правами chmod +x
Проблема выявлена на типах файлов .md и .txt.
Сценарии: 1 Создал новый файл -- буквы на месте. Сохранил как a.txt -- буквы на месте. Выхожу из vim, снова захожу в vim, открываю a.txt -- теперь нельзя вводить буквы "ж", "б" и "ю" на любых регистрах, вместо них символы из английской раскладки.
2. Создал новый файл, Сохранил как a.cpp. Вышел-зашёл в vim, открыл этот файл -- все буквы вводятся нормально.
Если удалить данный плагин, или dll которую он использует, то описанного не наблюдается.
установил Input Source Switcher - проверил, работает - issw в терминале переключает язык.
прописал в .vimrc
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/local/lib/libInputSourceSwitcher.dylib'
запустил vim - не работает авто переключение на US раскладку.
Из всех протестированных вариантов сработало только
let g:XkbSwitchILayout = 'ru'
При входе в vim в инсерт режим - включался русский, при выходе по Esc включался английский, при входе обратно в инсерт - опять русский.
Убираю эту строчку, и ничего не работает - автопереключение не срабатывает.
если оставляю вышесказанную строчку и добавляю
let g:XkbSwitchNLayout = 'us'
то при переключении в инсерт - русский переключается, и при выходе остается. Если включить принудительно английский, то при следующем заходе в инсерт на русский уже не переключается.
Хотелось бы, чтобы заработало так - при нормал режиме всегда был английский, при инсерт режиме, тот язык, который был включен последним в этом режиме.
Спасибо.
Честно говоря, сходу я не могу понять, как бы это могло работать. Но было бы здорово, если бы существовал какой-то способ заставить это работать по ssh.
Здраствуйте. Очень благодарен вам за плагин. Довольно долгое время он работал бесперебойно, но некоторое время назад я столкнулся с багом (?). Случилось это когда я переписывал конфиг для nvim (версия 0.6.0). Некоторое время он отказывался работать вовсе, но я всё же как-то его настроил и он работает. Сейчас при открытии любых файлов выбивает ошибки. Пробовал создать отдельный конфиг с только вашим плагином и результат не очень изменился, точнее совсем не изменился. Приложил скриншот ошибок (не всех, но они там почти не отличаются, буквально несколько чуть-чуть других ошибок если понадобится и их приложу).
Содержание конфигурации плагина:
Plug 'lyokha/vim-xkbswitch' let g:XkbSwitchEnabled = 1 let g:XkbSwitchLib = "/usr/lib/libxkbswitch.so" let g:XkbSwitchNLayout = 'us' let g:XkbSwitchIMappings = ['ru, uk, us']
Пробовал наверное все возможные конфигурации плагина, но только с этими он работал (могу для точности проверить не ошибся ли я если нужно).
Постарался дать столько информации сколько могу, надеюсь она будет полезна
Recently I switched from airline to lualine and I miss ability to see my layout right next to my current mode.
I thought I can add it by myself, but I cannot find how can I get current layout from this plugin
Добрый день!
Не получается настроить чтобы в нормальном режиме после выхода из поиска восстанавливалась английская раскладка, то есть сценарий такой:
в нормальном режиме, раскладка 'us'
нажимаю '/' для поиска
переключаю раскладку на 'ru' и ввожу русские символы,
затем нажимаю 'enter' vim находит текст и возвращается в нормальный режим
далее в нормальном режиме раскладка остается 'ru', а хотелось бы чтобы она автоматом возвращалась на 'us', как это происходит при выходе из insert mode.
ubuntu 22.04.01
gvim 8.2.4919
gdbus call --session --dest org.gnome.Shell --object-path /org/g3kbswitch/G3kbSwitch --method org.g3kbswitch.G3kbSwitch.List
(true, '[{"key":"0","value":"us"},{"key":"1","value":"ru"}]')
.vimrc:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchIMappings = ['ru']
let g:XkbSwitchNLayout = 'us'
let g:XkbSwitchAssistSKeymap = 1
let g:XkbSwitchLib = '/usr/local/lib/libg3kbswitch.so'
Узнал из документации, что имеется возможность настройки автоматического переключения раскладки на основе указания синтаксических правил в переменной g:XkbSwitchSyntaxRules.
Но возник вопрос.
Возможно ли автоматическое переключение языка раскладки, при входе в режим вставки, в зависимости от языка самого текста, который окружает текущее положение курсора?
Было бы удобно иметь уже включенной ту раскладку, которая соответствует текущему языку окружающего текста. Чтобы не затрачивать время на ручное переключение.
First, thank you for the great plugin! It is the real life-changer when you need to edit multilingual text.
I wonder, is there a way to switch layout when in normal mode? Occasionally, I realize that I need to switch all key maps to another language when in normal mode. Now I enter insert mode, switch the layout and then switch back to the normal mode. That sequence is time-consuming. Is it possible to replace that sequence above by a key combination somehow?
use {↲
'lyokha/vim-xkbswitch',↲
config = function()↲
vim.g.XkbSwitchEnabled = 1↲
vim.g.XkbSwitchIMappings = { 'ru' }↲
vim.g.XkbSwitchLib = '/run/current-system/sw/bin/' --или
vim.g.XkbSwitchLib = '/run/current-system/sw/bin/xkb-switch' ↲
end,↲
}
λ which xkb-switch
/run/current-system/sw/bin/xkb-switch
How about extracting ability to setup some keybindings like
for hcmd in ['gh', 'gH', 'g<C-h>']
exe "nnoremap <buffer> <silent> ".hcmd.
\ " :call <SID>xkb_switch(1, 1)<CR>".hcmd
endfor
out of this plugin? As it was done in vim-surround or in other way:
if !exists("g:surround_no_mappings") || ! g:surround_no_mappings
nmap ds <Plug>Dsurround
nmap cs <Plug>Csurround
nmap ys <Plug>Ysurround
nmap yS <Plug>YSurround
So user could replace them or disable. Cause I use all those mappings like gh, gH, g for my own purposes. They are too consistent with hjkl navigation))
@grwlf is it really complicated issue to add Wayland switching? E.g for sway.
The interface is similar to xkb and could be invoke with sway-msg from vim.
Системные раскладки заменены на http://ilyabirman.ru/projects/typography-layout/, установлены https://github.com/myshov/xkbswitch-macosx и https://github.com/myshov/libxkbswitch-macosx.
При english-раскладке команда
:echo libcall('/usr/local/lib/libxkbswitch.dylib', 'Xkb_Switch_getXkbLayout', '')
возвращает 2
, при русской, соответсвенно — 1. Корректно работают
:echo libcall('/usr/local/lib/libxkbswitch.dylib', 'Xkb_Switch_setXkbLayout', '1')
:echo libcall('/usr/local/lib/libxkbswitch.dylib', 'Xkb_Switch_setXkbLayout', '2')
устанавливая русскую и английскую раскладки.
В .vimrc
(vim-xkbswitch установлен через Vundle):
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.dylib'
let g:XkbSwitchIMappings = ['ru']
let g:XkbSwitchDynamicKeymap = 1
let g:XkbSwitchKeymapNames = {'1' : 'russian-jcukenwin'}
set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0
Что ещё я упускаю? Не работает ни автомаппинг, ни возврат к предыдущей раскладке при выходе из Insert-mode.
Если до загрузки плагина не выставлена переменная g:XkbSwitchEnabled
, vim выдаёт ошибку:
Обнаружена ошибка при обработке /home/petrushka/Dropbox/dotfiles/yadr/.yadr/vim/bundle/vim-xkbswitch/plugin/xkbswitch.vim:
строка 241:
E121: Неопределенная переменная: g:XkbSwitchEnabled
E15: Недопустимое выражение: g:XkbSwitchEnabled
Видимо, нужен какой-то обработчик на случай, если плагин установлен, но не используется.
Кроме того, если g:XkbSwitchEnabled
будет установлен слишком поздно (например, после инициалзиации плагина), то плагин не "подсосёт" его значение. Видимо, об этом тоже стоит предупредить.
При включенной русской раскладки ru(dvp) и выходе из режима вставки в нормальный режим, расскладка не переключается на en(dvp)
русский dvp:
https://github.com/binarin/russian-programmer-dvorak
When exit and return to Insert, layout is not remembered. If I write in Russian in Insert, then press Esc and exit to Normal, the layout changes to English, as it should. But when I go back to Insert, the layout does not change back to Russian and stays English.
Пользуюсь раскладкой Programmer Dvorak, и в следующей конфигурации попытался перезаписать маппинг по умолчанию для qwerty:
let g:XkbSwitchIMappingsTr = {
\ 'ru':
\ {'<': ';,.pyfgcrl`/@aoeuidhtns-''qjkxbmwvz'.
\ ':<>PYFGCRL?^AOEUIDHTNS_"QJKXBMWVZ~75390|',
\ '>': 'йцукенгшщзхъфывапролджэячсмитьбюё.'.
\ 'ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,Ё"№;:?/'},
\ }
let g:XkbSwitchIMappings = ['ru']
При входе в режим вставки переключаюсь с дворака на русскую раскладку, затем нажимаю ^R (^O на qwerty) и любой регистр вставки, ничего не происходит. Однако если я тоже самое делаю как если бы у меня была qwerty, т.е. комбинация ^P на двораке (^R на qwerty соотвественно) то текст вставляется из регистров.
Что делаю не так?
If the original mapping uses, say, a script local function nnoremap ; :<c-u>call <sid>function()<cr>
, then the duplicate mapping, say ö
, does not work because the script local SID
is no longer correct that where the duplicate mapping is defined.
Could patch 8.2.4861 resolve this?
Доброго времени суток. Терминале xfce4 при открытии vim выводиться(в место где мы привыкли видеть файл) следующая строка: /khaser/build/xkb-switch/src/XKeyboard.cpp:110: raw layout string "us,ru"
. Причём сам файл не меняется и, если развернуть терминал на всё окно, то надпись пропадёт. В tty проблема пропадает. Пробовал просто скомпилировать xkb-switch без этого вывода в cerr, но тогда вообще всё ломается.
При установке этих переменных одновременно работает, только первая из установленных.
let g:XkbSwitchILayout = 'us(dvp)'
let g:XkbSwitchNLayout = 'us(dvp)'
Is it possible to implement following:
So, is it possible to combine SELECT and INSERT mode layouts, and do not switch layout, when switching between this modes?
I'm currently using the plugin on elementary OS 6.1 (based on Ubuntu focal) stripped of DE, with bspwm in place. I can't however get the plugin to work. presumably it has to do with the GUI, given that you've referenced linux and the i3 variant too.
Current configuration
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so'
let g:XkbSwitchIMappings = ['ru']
Шаги для повторения:
Первопричина, видимо, в либе xkb-switch.so, но всё же неприятно.
Очевидно, что через xkb-switch по ssh никак работать не будет, но хотя бы падать оно не должно.
Здравствуйте! На свежеустановленную Ubuntu 16.04 только поставил vim. Никаких плагинов для vim-а нет. Сделал все по инструкции, собрал xkb-switch, скопировал плагин в (~/.vim/plugin, ~/.vim/doc, ~/.vim/xkbswitch.tr). Прописал в ~/.vimrc следующее:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/lib/libxkbswitch.so'
let g:XkbSwitchIMappings = ['ru']
И не работает.
Попробовал:
$ xkb-switch -l
us
ru
В vim-е переключается с русской на английскую:
:call libcall('/usr/lib/libxkbswitch.so', 'Xkb_Switch_setXkbLayout', 'us')
также:
:echo g:XkbSwitchEnabled
> 1
:echo g:XkbSwitchLib
> /usr/local/lib/libxkbswitch.so
:echo g:XkbSwitchIMappings
> ['ru']
:echo libcall('/usr/local/lib/libxkbswitch.so', 'Xkb_Switch_getXkbLayout', '')
> ru
Подскажите пожалуйста, что можно сделать?
sorry for my disturbance!
in insert mode, i press
<c-o>:call system('g3kb-switch -s libpinyin')<CR>
(libpinyin is an input method)
the input method don't change. but when i quit the insert mode, it change to libpinyin
in normal mode...
i know SuperSpace can switch input method. but i want a method to change it in vim.
thanks!
Hello,
thank you for your amazing plugin. It has solved elegantly a problem that I had since I have started to learn to use Vim with qwerty keyboard, but typing with french bépo layout.
I have one question : in insert mode, layout switches from my locale (fr(bepo) in my case) to us layout, when a documentation float window is triggered by Neoclide Coc Intellisense-like plugin.
cfv https://github.com/neoclide/coc.nvim, and screen captures on https://www.reddit.com/r/neovim/comments/b1pctc/float_window_support_with_cocnvim/ to see how it looks like.
It sticks to us layout after the float window disappear, so I end up typing in qwerty instead of bépo whenever I hit some autocompletion trigger.
Is there a known workaround ?
this is an excerpt of a vim log, but feel free to close issue if appropriate as is really a borderline case.
chdir(/home/evoludigit/code/project)
Executing InsertEnter Autocommands for "*"
autocommand let s:XkbSwitchLastIEnterBufnr = bufnr('%') | call <SID>xkb_switch(1)
Executing InsertEnter Autocommands for "*"
autocommand call s:Autocmd('InsertEnter', +expand('<abuf>'))
Executing InsertEnter Autocommands for "*"
autocommand match ExtraWhitespace /\s\+\%#\@<!$/
-- INSERT --
Executing CursorMovedI Autocommands for "*"
autocommand call s:Autocmd('CursorMovedI', +expand('<abuf>'), [line('.'), col('.')])
Executing CursorMovedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()
Executing CursorMovedI Autocommands for "<buffer=1>"
autocommand call SemshiCursorMoved(line('w0'), line('w$'))
Executing User Autocommands for "AirlineModeChanged"
autocommand call airline#mode_changed()
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)
chdir(/home/evoludigit/code/project)
Executing CursorHoldI Autocommands for "*"
autocommand call s:Autocmd('CursorHoldI', +expand('<abuf>'))
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)
Executing InsertCharPre Autocommands for "*"
autocommand call s:Autocmd('InsertCharPre', v:char)
airline: group: airline_error already done, skipping
airline: group: airline_error_bold already done, skipping
airline: group: airline_error_red already done, skipping
airline: group: airline_warning already done, skipping
airline: group: airline_warning_bold already done, skipping
airline: group: airline_warning_red already done, skipping
airline: group: airline_c already done, skipping
airline: group: airline_c_bold already done, skipping
airline: group: airline_c_red already done, skipping
airline: group: airline_term already done, skipping
airline: group: airline_term_bold already done, skipping
airline: group: airline_term_red already done, skipping
Executing User Autocommands for "AirlineModeChanged"
autocommand call airline#mode_changed()
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)
chdir(/home/evoludigit/code/project)
chdir(tests/entrypoints)
chdir(/home/evoludigit/code/project)-- INSERT --
Executing CursorMovedI Autocommands for "*"
autocommand call s:Autocmd('CursorMovedI', +expand('<abuf>'), [line('.'), col('.')])
Executing CursorMovedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()
Executing CursorMovedI Autocommands for "<buffer=1>"
autocommand call SemshiCursorMoved(line('w0'), line('w$'))
Executing TextChangedI Autocommands for "*"
autocommand call s:Autocmd('TextChangedI', +expand('<abuf>'), {'lnum': line('.'), 'col': col('.'), 'pre': strpart(getline('.'), 0, col('.') - 1), 'changedtick': b:changedtick})
Executing TextChangedI Autocommands for "*"
autocommand call s:Highlight_Matching_Pair()
Executing TextChangedI Autocommands for "<buffer=1>"
autocommand call SemshiTextChanged()
Executing FuncUndefined Autocommands for "SemshiTextChanged"
autocommand call remote#define#FunctionBootstrap("python3", "/home/evoludigit/.config/nvim/plugged/semshi/rplugin/python3/semshi:function:SemshiTextChanged", v:false, "SemshiTextChanged", {}, "RPC_DEFINE_AUTOCMD_GROUP_6")
I used this plugin for a long time, but after I updated some other plugins, vim starts to lagging very hard(scrolling, moving cursor, etc). To research this problem, I turn off plugins one by one and it looks like xkbwitch cause of the problem. Don't know how updating of other plugins could break xkbswitch.
По хоткею "< C-N >v" у меня стоит NerdTree. Плагин создаёт локализованный хоткей "< C-N >м". Однако моя убунта посылает "< C-рус.Т >м" и NerdTree не запускается
$ uname -a
Linux dxp-7750G 3.2.0-40-generic #64-Ubuntu SMP Mon Mar 25 21:22:10 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Поставил вчера Ваш плагин в Ubuntu 19.10 на X11. Все отлично, пока не могу разобраться с двумя вещами. То ли я чего-то не пойму, то ли этого функционала нет.
Чтобы при поиске (/
) автоматом переключалась раскладка, настроил Keymap Assitance по документации. Работает, но одна проблема: когда нахожусь уже в строке поиска, не могу переключить раскладку. Например, если в инсерт-моде печатал на русском, то когда выхожу в нормал-мод и жму поиск (/
), то я опять печатаю на русском. Отлично. Но тут понимаю, что мне нужно искать по-английски (в тексте имеются слова на обоих языках). Жму переключалку (в моем случае - win+space), продолжает печатать в строке поиска по-русски. Но зато после нажатия escape в нормал-моде раскладка оказывается русской. Это баг? Или я чего-то недонастроил?
В инсерт-моде с русской раскладкой не работают шорткаты с control-клавишей. Скажем, всплывает менюшка автодополнения, но я не могу ничего в ней выбрать с помощью и .
First of all I'd like to say how useful your plugin is, very interesting
indeed! I also find it would be very useful in Pentadactyl since the mode
changing workflow is much like vim's. Is there such possibility?
When i switch to normal mode (by pressing esc) from insert mode with russian layout not switched to english there is a short but unpleasant time lag (about one second) before i can use normal mode command (not switching to english manually).
I use Ubuntu 18.04 LTS with i3-wm, PC: thinkpad yoga s1
Иногда возникает необходимость исправить одну букву в строке и я использую для этого комманду r{char}. При этом смена раскладки не происходит. Хотелось бы иметь такую фичу.
ArchLinux, VIM.
Выставил:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchLib = '/usr/lib/libxkbswitch.so'
let g:XkbSwitchIMappings = ['ru']
$ xkb-switch -l
us
ru
Перезапускаю VIM.
Пытаюсь сделать хоть что-то dd
не пашет, двоеточие не пашет. Но при этом в режиме вставки работают горячие клавиши. Например, ctrl+t, что в русской, что в английской раскладке сдвигает текст.
vim --version: https://gist.github.com/petRUShka/8fc456fedcd2d4ac3aa2
Версия xkb-switch -- последняя из git: 20130407
Hi.
It stopped working few days ago and I don't know why. En/Ru layouts, Alt-Shift
to switch between them. Steps to reproduce:
I did plugins update around that time, so I rolled back to 0.15
, but it didn't help.
I have Bitdefender Security Endpoint Antivirus software and it caused issues for me in the past with other software, like blocking silver searcher
. I can imagine that it somehow prevents DLL to do layout switch.
Could you tell if there is a way to debug/diagnose what happens?
Thank you!
vim-xkbswitch/plugin/xkbswitch.vim:126
Error detected while processing function 180_tr_load:
line 8:
E684: list index out of range: 0
E15: Invalid expression: data[0] == '<' || data[0] == '>'
In other-than english layout (for example in Russian) dot may be on unusual place. For example for Russian layout /
key (which in English layout start search) is .
. So when you want to make search and have by accident Russian layout instead of English you face dot command instead of search. Last can be pretty destructible: delete couple of lines or insert some non sense and etc.
Idea is to have an option to disable or remap .
in non-english layout to avoid such unexpected and annoying behavior.
Добрый день!
Успешно использую ваш замечательный плагин под виндами, сейчас перехожу на ubuntu, но пока не удалось заставить его работать.
Сначала попытался собрать xkb-switch отсюда
https://github.com/ierton/xkb-switch/releases/tag/1.6.0 по инструкции
https://github.com/ierton/xkb-switch#installing
Но не удачно, на шаге
cmake ..
получаю ошибку
CMake Error at /usr/share/cmake-3.10/Modules/FindX11.cmake:429 (message): Could not find X11
Побороть эту ошибку не удалось.
Нашел этот пакет в PPA и установил
sudo add-apt-repository ppa:atareao/atareao
sudo apt update
sudo apt install xkb-switch
правда версия 1.4.0
xkb-switch -l
выдает
us
ru
us
После этого попробовал - плагин не работает.
.vimrc:
let g:XkbSwitchEnabled = 1
let g:XkbSwitchIMappings = ['ru']
"плагин ставится с помощью Vandle
Plugin 'lyokha/vim-xkbswitch'
Прочитал в документации про
let g:XkbSwitchLib = '/usr/local/lib/libxkbswitch.so'
но у меня по этому пути такого файла нет.
r
and f
commands not working with configuration from readme:
let g:XkbSwitchAssistNKeymap = 1 " for commands r and f
let g:XkbSwitchAssistSKeymap = 1 " for search lines
XkbSwitchAssistNKeymap -> not working
XkbSwitchAssistSKeymap -> working, but have deprecation messages when vim started
tried with:
set keymap=russian-jcukenwin
set iminsert=0
set imsearch=0
and
let g:XkbSwitchDynamicKeymap = 1
Было бы удобно, если бы текущая раскладка insert mode запоминалась / восстанавливалась не для всего окна vim, а для каждого отдельного буфера.
subj
Really cool idea! Is there a way to not switch back to last active layout when going back to insert/select modes? I want to only switch back to us
automatically when going to normal. Ideally I would like to set this on a per-buffer basis with aucmd Filetype
or custom mappings. Is this possible?
Hello @lyokha,
I encountered your plugin while I saw it's extension on airline and I'm very impressed by it's features and documentation but I'm not sure I totally understand why would I need it.
Up until now, I used the vanilla &keymap
setting of Vim and it was always enough for me. It even provides assistance in Normal mode as your plugin suggests to provide it as well (haven't succeeded yet in configuring it on my machine and with il
keyboard layout).
One feature though which seems to be very promising is Custom keyboard layout switching rules. Vanilla Vim doesn't provides it I'm sure.
What am I missing?
The issue is very weird and I completely understand and acknowledge its weirdness, I also assume there could be something terribly wrong with my setup, however despite my thorough trials I couldn't figure out the root cause, so decided to ask for an advice here.
vim-xkbswitch
plugin doesn't switch the layout when exiting to normal mode (from insert). For instance: I start Vim, go into insert mode, switch layout to Russian and type some text, press Esc
to return to normal: layout doesn't change. What's weird: if I manually switch back to English and repeat the procedure: go to insert, type something, exit to normal again --- then the layout gets switched (but back to Russian, since I already was in English after manual switch, so it just inverts the layout).
Sounds crazy, but basically layout switch works only on the second call.
I have tried to remove all plugins and configurations from my .vimrc
, only leave the minimal few lines to enable vim-xkbswitch
, removed xxkb
, changed Xkb settings to simplest possible setup setxkbmap -layout 'us,ru'
even though I usually have more complicated configuration and 3 layouts.
But the issue persisted: libcall
to libxkbswitch
switched the layout only on the second call, so the plugin messes up and gets completely confused. At the same time console utility (xkb-switch
) works as expected and successfully switches layouts with just one call. That's the reason why I decided to open issue here instead of xkb-switch
repo, as the issue actually happens only when I use it through Vim.
I went down to just manually perform the libcall
from Vim console like so:
:call libcall(g:XkbSwitchLib, Xkb_Switch_setXkbLayout, 'ru')
And again nothing happens on the first call, only when I repeat this command for the second time, the layout actually changes (same when I use this command to switch back to English).
I even tried to remove the plugin and Vundle completely, and just paste the code from your article straight into .vimrc
, but the behavior is the same.
For now I could only workaround the issue by literally duplicating all set
calls to Xkb in the plugin --- then it works.
OS: Arch Linux (of course everything is updated to latest versions).
$ pacman -Qi xkb-switch-git
Name : xkb-switch-git
Version : 20150826-4
...
$ pacman -Qi libxkbcommon-x11
Name : libxkbcommon-x11
Version : 0.6.1-1
...
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 2 2016 05:21:06)
Included patches: 1-2143
Compiled by Arch Linux
Huge version with GTK2 GUI.
...
Please let me know if there's any other useful debug info I can provide. If only I could debug the libcall
to Xkb in detail to see what's actually going on, but I don't know how, and strace
on xkb-switch
itself wouldn't help, as the command line utility works fine: it's only libcall
from Vim that misbehaves.
Thank you!
I realized that this commands doesn't work in russian layout.
When I press Alt-o
or Alt-O
in english it gives me new line and stay in insert mode, but in russian layout this doesn't happen.
Shouldn't it be mapped automatically?
DelimitMate - this is a very popular plugin for automatically closing pairs of chars ('
, "
, [
, (
) and it does other realted stuff.
I was trying to install it and find out that delimitMate cause insertion chars '
, [
and ]
instead of э
, х
and ъ
resprectively. When I troubleshooted that problem I found out that without vim-xkbswitch being loaded this plugin works without errors.
Is it problem of vim-xkbswitch or delimitMate itself?
By the way here is realated issue from delimitMate's repository, hope it helps maybe Raimondi/delimitMate#13
I just installed the plugin and it works really nicely. Just one thing, I haven't figured out how to do, is: How can I restore my original key map as opposed to the normal mode one, when exiting vim.
I use swiss layout for typing text and us for vim normal mode. So I'd like vim to go back swiss layout, once I exit vim, as opposed to staying us. Is there any way to do that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.