Comments (6)
i try call libcall('/usr/local/lib/libg3kbswitch.so', 'Xkb_Switch_setXkbLayout', 'libpinyin')
. the result is same as call system('g3kb-switch -s libpinyin')
...
from vim-xkbswitch.
Hi.
I wonder, why are you calling system/lib methods when you can simply switch layout by a system method/key? Or is this for a script?
I checked behaviour with xkb-switch and I believe that g3kb-switch must behave the same way. So, why this happens:
- You are in Insert mode with, say, us keyboard layout,
- You pressed
<C-o>
thus effectively switching to Nomal mode, the plugin saved previous layout in Insert mode as us, - You changed keyboard layout to libpinyin (I used ru) and press
Enter
, - Insert mode returns and brings back us,
at this step you may notice a fast blink of the language selector in the system tray: it fastly switched to libpinyin and back.
Then:
- You exited from Insert mode and unexpectedly got libpinyin,
this is because the layout for Normal mode has been saved as well, and this was libpinyin when the Normal mode was abandoned.
To prevent this switch, you can put into the .vimrc line
let g:XkbSwitchNLayout = 'us'
Now keyboard layout in Normal mode will always be us, it seems to be a sane setting for all cases.
from vim-xkbswitch.
Now keyboard layout in Normal mode will always be us, it seems to be a sane setting for all cases.
thank for your answer! you are right.
I wonder, why are you calling system/lib methods when you can simply switch layout by a system method/key? Or is this for a script?
in truth, i want to take a try.
at this step you may notice a fast blink of the language selector in the system tray: it fastly switched to libpinyin and back.
why it fastly switch back? can i know the reason? thanks!
from vim-xkbswitch.
Hmm, i told you why it happens, but did not answer the question how to switch layout in Insert mode... Probably, it is not possible with the current implementation. I will tell you if I get the answer.
from vim-xkbswitch.
Hah, this is easily achieved if playing with the plugin internals, simply replace
<c-o>:call system('g3kb-switch -s libpinyin')<CR>
with
<c-o>:let b:xkb_ilayout='libpinyin'<CR>
Now the switch must work correctly, as you expect!
from vim-xkbswitch.
Thanks!
from vim-xkbswitch.
Related Issues (20)
- Cannot switch layout while searching + cannot use shortcuts with modifier keys 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
- How to make it work on wsl? 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.