1

In Practical Vim, Drew Neil emphasised a tip: Chunk Your Undos in vim insert mode.

use Esc+o instead of press <CR> to force a back to normal mode, so that when you press next time, you will just undo the line you just opened.

That's really a practical advise! So I tried to map Shift+Enter to Esc+o in my .vimrc file with imap <C-return> <ESC>o, but it just not works. Any ideas?

2

Your :imap should work in GVIM, but in console Vim (both Windows and Linux), Ctrl + Enter cannot be mapped.

Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination.

Use a different key combination, e.g. <C-g><Enter>.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.