Card key for switching between normal mode and insert mode in Vim

I would like to use two “controls” as a switch to switch between normal mode and insert mode in Vim . So I add the following two lines to my .vimrc

 nmap <C-><C-> i imap <C-><C-> <ESC> 

But that will not work. What is wrong with these two lines?

+4
source share
4 answers

It seems you are trying to display Ctrl + Space to switch the insert mode.

 nnoremap <C-space> i imap <C-space> <Esc> 

(Derived from this Vim tip (designated obsolete, but there is a link to a richer exception document that includes a hint).

Remember that this does not guarantee the operation of all terminals and platforms. Some terminals and platforms may have this Ctrl + something shortcut, while others may not, so find one that works in your environment.

+5
source
 nnoremap <silent><C-space> :startinsert inoremap <silent><C-space> <CO>:stopinsert 
+1
source

It definitely won't work. Instead, you can use the F key.

0
source
 nnoremap <C-SPACE> i inoremap <C-SPACE> <ESC>l 

works great with gvim 7.4

0
source

Source: https://habr.com/ru/post/1299694/


All Articles