Use shortcut to replace “Esc” in VIM/GVIM

March 22, 2007

I bought a second hand Canon 300D recently. Had much fun with it. I’ll probably write something about using a DSLR in Ubuntu. Really love this “old” camera.

OK. Here is the problem I recently found when I was using GVIM-latex-suite to type my final thesis, when I want to change back to normal mode from the insert mode by pressing “Esc” it is quite unconfortable. Although “Esc” key is not far from other keys, it is just not that convenient. Because when you typing, your fingers are alway around “ASDF”and “JKL:” keys. You’ll need to move your hand to reach the “Esc” key…

This can be quite easy to solve. I am sure there is a way using VIM setting itself to remap Esc key. But don’t want to research such settings. The KDE control center, can do this quite easily. Here is the steps:

  1. KDE control center-> Reginal & accessibility-> Input Actions.
  2. “New Action”. Note you’d better to create a new group first.
  3. Go to “Trigger” tab, “New”-> Shortcut Trigger-> I use “Right Alt +  L”. It’s quite convenient when you are in the type position. Try it yourself.
  4. Go to “Actions” tab, “New”-> Keyboard input -> type Escape.
  5. Leave all the other settings default.

That’s it. Now in every active windows, if you press “Right Alt+L” the actual key activated is “Esc” key. Enjoy your VIM typing!