Comments (7)
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).
This is really suspicious. Here vim must call the function from the library without any additional processing and if it fails then there is something wrong with the function or libcall. I built latest xkb-switch
on my desktop and it works as fine as before. What if there is something wrong with the Arch xkb-switch? I have looked at this and read in comments that it must depend on libxkbfile
but it does not if I got it correctly.
Can you build xkb-switch manually from here and try the new library that it would install?
from vim-xkbswitch.
I re-checked that and found that It worked bad only when optimization was on, exactly as you told. See my comment and the patch at the xkb-switch
bug report. This must work. Surprisingly, my old fork worked fine with optimization set, yet it used the same XkbLockGroup()
without accommodation.
from vim-xkbswitch.
Looks like the plugin is unable to determine keyboard layout that was set on vim load in your case. I'll look at details tomorrow because I do not have time today. But anyway setting
let g:XkbSwitchNLayout = 'us'
must work. Please try this and also show all your vim settings regarding the plugin. You can try also
let g:XkbSwitchLoadOnBufRead = 1
this forces to load plugin on BufRead event but may clash with other plugins like EnhancedJumps in my case. If you're using the second setting, the first one is optional, however I would recommend to use the first because forcing English layout in Normal mode always looks sound. Btw here are my settings:
" ---- Automatic keyboard layout switching upon entering/leaving insert mode
" ---- using xkb-switch utility and plugin xkbswitch
" ----
let g:XkbSwitchEnabled = 1
let g:XkbSwitchIMappings = ['ru']
let g:XkbSwitchNLayout = 'us'
let g:XkbSwitchILayout = 'us'
" loading xkbswitch on BufRead when bufhidden=delete will clash xkbswitch
" function imappings_load() and plugin EnhancedJumps as soon as both will do
" redir simultaneously!
let g:XkbSwitchLoadOnBufRead = 0
let g:XkbSwitchSkipIMappings =
\ {'c' : ['.', '>', ':', '{<CR>', '/*', '/*<CR>'],
\ 'cpp' : ['.', '>', ':', '{<CR>', '/*', '/*<CR>']}
let g:XkbSwitchSkipFt = [ 'conque_term' ]
let g:XkbSwitchAssistNKeymap = 1 " for commands r and f
let g:XkbSwitchAssistSKeymap = 1 " for search lines
let g:XkbSwitchDynamicKeymap = 1
let g:XkbSwitchKeymapNames = {'ru' : 'russian-jcukenwin'}
from vim-xkbswitch.
Thanks for the reply! Unfortunately I've tried all the suggestions, including just copying your config, but the problem still persists.
My current config:
let $VIMHOME=$HOME . "/.vim"
let $VIMBUNDLE=$VIMHOME . "/bundle"
filetype off " Filetype recognition must be disabled for Vundle setup.
set rtp+=$VIMBUNDLE/Vundle.vim/
call vundle#begin()
Plugin 'VundleVim/Vundle.vim' " Vim plugin manager.
Plugin 'lyokha/vim-xkbswitch' " Automatic keyboard layout switcher.
call vundle#end()
filetype plugin indent on
let g:XkbSwitchEnabled = 1
let g:XkbSwitchIMappings = ['ru']
let g:XkbSwitchNLayout = 'us'
let g:XkbSwitchILayout = 'us'
let g:XkbSwitchLoadOnBufRead = 0
let g:XkbSwitchSkipIMappings =
\ {'c' : ['.', '>', ':', '{<CR>', '/*', '/*<CR>'],
\ 'cpp' : ['.', '>', ':', '{<CR>', '/*', '/*<CR>']}
let g:XkbSwitchSkipFt = [ 'conque_term' ]
let g:XkbSwitchAssistNKeymap = 1 " for commands r and f
let g:XkbSwitchAssistSKeymap = 1 " for search lines
let g:XkbSwitchDynamicKeymap = 1
let g:XkbSwitchKeymapNames = {'ru' : 'russian-jcukenwin'}
If I set
let g:XkbSwitchLoadOnBufRead = 1
I get error No mapping found
on startup, however I do have russian-jcukenwin.vim
mapping in /usr/share/vim74/keymap
directory :\
from vim-xkbswitch.
@lyokha You are right, it is indeed something wrong with Arch AUR package xkb-switch-git
— once I built locally from upstream repo and replaced libxkbswitch.so
, the plugin started working as expected again.
Though the symptoms were indeed suspicious, the Arch PKGFILE
seems to be straightforward, yet it does something wrong that libxkbswitch
starts to act so weird.
I'll try to figure it out and fix the AUR package for Arch, but now that's a different story :)
Thanks for the help to sort this out!
from vim-xkbswitch.
Just for your information, turns out makepkg
builds Arch packages with -O2
compile flag by default and this causes problem with xkb-switch
library. I've tried to manually compile upstream xkb-switch
code with -O2
and was able to reproduce the same problem using the resulting lib without building Arch package.
Now it's clear that the problem originates from xkb-switch code.
Thanks for the help!
from vim-xkbswitch.
Hmm. Actually I built my old fork of xkb-switch and it worked fine at any optimization level. The upstream xkb-switch does work as you explained at any optimization level. I will try to figure out what's wrong.
from vim-xkbswitch.
Related Issues (20)
- Disable dot (repeat last command) in non-english layouts in normal mode HOT 3
- Cannot switch layout while searching + cannot use shortcuts with modifier keys in insert mode HOT 6
- [question] how to change input method in insert mode? HOT 6
- xkb-switch triggered by neoclide Coc documentation float window HOT 2
- vim-xkbswitch does not remember the layout HOT 1
- Windows 10, gvim/nvim-qt, stopped working - how to debug/diagnose? HOT 3
- Unexpected output to textarea HOT 2
- Появление ошибок во время открытия файла HOT 15
- Switch layout when in normal mode HOT 5
- Sway support HOT 1
- Question. How can I get current layout? HOT 2
- How to use vim-xkbswitch with i3wm? HOT 2
- Bspwm Support HOT 1
- Не находит бинарник xkb-switch HOT 1
- Can't restore Normal mode keyboard layout when leaving search '/' mode HOT 6
- mapping duplicate for script local mapping HOT 10
- Keymap assistance in Normal mode not working HOT 8
- Не удается заставить работать на Ubuntu 22.10 HOT 5
- Does not work with lazy.nvim HOT 8
- Doesn't switch language when exiting Insert mode HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-xkbswitch.