Comments (5)
@coordinatio, ImInsertToggle()
looks good except you'd better use setlocal
instead set
in both clauses to not affect iminsert
globally rather than in the current buffer. I also fixed the bug with the dynamic keymap assistance that I'd mentioned.
from vim-xkbswitch.
Hi.
I wonder, is there a way to switch layout when in normal mode?
Do you mean that Vim would alter some state after triggering system keyboard layout switch? If so, then no: system keyboard layout change cannot be caught inside Vim as it is only caught by the desktop environment.
Occasionally, I realize that I need to switch all key maps to another language when in normal mode.
What kind of key maps do you mean? The plugin does not affect Vim's Normal mode maps in any way, it only may load the Insert mode maps (i.e. imaps) which have no effects in Normal mode.
from vim-xkbswitch.
For example, let's suppose that you need to edit multilingual text like that:
A word in English, а теперь слово на русском.
You have left the insert mode when you were writing the Russian text, you are at the end of the line and need to jump to the beginning of the word English
by pressing FE
. You cannot do that because of the mappings active. So, you must enter insert mode, switch the layout, exit the insert mode and then if you press FE
that will do what you want.
The idea is to avoid that "enter insert mode - exit insert mode" sequence. Would you please recommend how to do that?
from vim-xkbswitch.
Ok, this looks like an effect of the Keymap assistance in Normal mode. Removing
let g:XkbSwitchAssistNKeymap = 1
let g:XkbSwitchDynamicKeymap = 1
from the Vim's config file should fix this. Or, if you still want to use the keymap assistance, you may reset iminsert
by typing
:set iminsert=0
(you can also define a map for this in Normal mode, notice also that the language in the search line can be switched easily by Ctrl-^
).
Btw while digging through this issue I found a small bug: when g:XkbSwitchDynamicKeymap
is on then both g:XkbSwitchAssistNKeymap
and g:XkbSwitchAssistNKeymap
is automatically on regardless of their values in the Vim config. I am going to fix this.
from vim-xkbswitch.
Thanks for the advice!
I've made the following change in my .vimrc and it seems like the perfect solution I have been searching for!
function! ImInserToggle()
if &iminsert
set iminsert=0
else
set iminsert=1
endif
endfunction
nnoremap <a-k> :call ImInserToggle()<cr>
Thank you so much!
from vim-xkbswitch.
Related Issues (20)
- 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
- 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.