Hacker News new | ask | show | jobs
by Assossa 2657 days ago
Ctrl-[ is a good replacement for escape but I've found it's not always supported in every vim implementation. If I remember correctly it doesn't work in the visual studio vim plugin.

Binding something like JJ to escape is also a good solution, but if you ever have to edit on another machine without your vimrc, your speed will seriously suffer. I try to not change/add any core hotkeys for this exact reason. I can ssh into a brand new Linux install and edit with stock vi at the same speed as on my development machine's vim install.

I discovered that Ctrl-C is another default escape alternative. It's worked on everything I've tried so far: vi, vim, nvim, gvim, vim over ssh, vim for visual studio, vim for IntelliJ, etc. This is what I've gotten used to using. Another benefit is if you're using a non-vi editor and try to exit insert mode out of habit, Ctrl-C won't actually do anything, whereas Ctrl-[ could be a hotkey in that program and JJ will obviously insert two unwanted characters in your document.

3 comments

Ctrl-C will keep certain events from firing in vim (can't remember their names off the top of the head, something like OnInsertLeave).

Remap caps lock to escape on your computer and it'll work in every editor and every machine you ssh into.

But I'm using Caps Lock to type Ctrl-C!
Caps Lock :)