Vim: How to Remap the Escape Key?

Master emacs+lisp, benefit for life. Testimonials. Thank you for support.
, , …,

How to remap the Escape key?

create a file at ~/.vimrc, and put the following

"make jj do esc"
inoremap jj <Esc>

"make esc do nothing"
inoremap <Esc> <Nop>

this will make 【jj】 do Esc, and disable the Esc key. (thanks to 00Davo〔☛ Programer Hand Health: vi Esc Key Syndrome#comment-1426377905〕)

if you have a special keyboard (such as the ergodox 〔☛ Ergonomic Keyboards〕 ) where the {↖ Home, ↘ End} keys are right under your thumbs, then you can make them do command mode and insert mode, like this:

"make home key do esc when in insertion mode"
:imap <Home> <Esc>

"make end key go to insertion mode, when in command mode"
:map <End> i

"turn on line numbering"
:set number
Like what you read?
Buy Xah Emacs Tutorial
or share some
blog comments powered by Disqus