Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> if you are having trouble with getting into and out of insert mode, maybe Vim isn't for you.

I've got a question there actually. The only thing that throws off my flow while using Vim is exiting insert mode, as my keyboard has an inconvenient esc key. Is there a better way to exit? I've done some cursory looking but haven't found anything that looks useful.

(Remapping my keyboard isn't a viable option, as I game on my machine sometimes, and occasionally need weirdly specific keys.)



Ctrl-C and Ctrl-[ also work by default, but personally I use CapsLock after doing `setxkbmap -option caps:escape`.

> Remapping my keyboard isn't a viable option, as I game on my machine sometimes

You can also map something specifically on vim with :imap/:vmap/:cmap.


Please note that Ctrl-C does not do the same thing as Esc or Ctrl-[. More info: https://unix.stackexchange.com/questions/53633/does-using-ct...


> Quit insert mode, go back to Normal mode. Do not check for abbreviations. Does not trigger the InsertLeave autocommand event.

Well, it's the same if neither you nor a plugin uses abbreviations nor InsertLeave.

Also, if you don't need that particular behavior of <C-c>, you can do `:map <C-c> <Esc>` to make it behave exactly the same.


The best remap in my vimrc:

" Map jk to ESC in insert mode

inoremap jk <esc>

Once you've finished what you wanted to insert just hit jk. The combination never occurs in the English language and is right on the home row :)


That's fun. Does it type the j, then delete it when you press k?


Yes it does. I do the same thing but with jj.


It doesn’t type it into a buffer, iirc. I removed that from my config because it annoyed me that when I press j alone it only appears in a buffer after a delay.


yes, until you find yourself typing jk into word docs or other evil office software every time you finish a thoughtjk.


I remap capslock as escape, using autohotkey, and I game a lot, the dyson sphere program was the first game that actually had a problem, so you can either turn the script off while playing, or make the script smarter to not be active during the game. Having said that, it is worth getting used to Ctrl-[ which is the same thing, and is a standard binding which is useful when you are not on your own machine.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: