Map key to toggle between normal mode and insert mode in Vim

vim

Solution

It seems you are trying to map Ctrl+Space to toggle insert mode.

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

(Came from this Vim tip (marked obsolete, but there's a link to a more rich document on avoiding which includes the tip).)

Remember that this is not guaranteed to work across all terminals and platforms. Some terminals and platforms may eat a given Ctrl+something shortcut, while others don't, so find one that works in your environment.

Problem

I'd like to use two "controls" as a toggle key to switch between normal mode and insert mode in Vim. So I add the following two lines into my `.vimrc` ``` nmap <C-><C-> i imap <C-><C-> <ESC> ``` But it doesn't work. What's wrong with the above two lines?

Original source