1

I'd like to re-map the <esc> key for switching to normal mode from edit mode. It just feels to far out of the way for me. I heard some have mapped this to the <caps lock> key instead. Can anyone show how to do this and what other key they might have used?

3
  • 1
    This is done at the OS level; my caps lock is configured to send control, but I think esc is an option. Anyway, dont remap esc itself to anything (breaks a lot of stuff). I found the jk tip below to get in my way after a few years of use, but ymmv
    – D. Ben Knoble
    Commented May 7, 2020 at 0:23
  • 1
    As mentioned by DBK I, too, think mapping caps lock to ctrl is the way to go. ctrl is mandatory in vim, and having it on the home row of the keyboard makes life easier. If you do this, esc is then available quite easily with ctrl-[.
    – Biggybi
    Commented May 7, 2020 at 3:43
  • 1
    Thanks! I think that mapping at the OS level should be a full answer as well. The comment by @filbranden directly lead me to the answer since I am on macOS. I like mapping <caps lock> to <ctrl> as well.
    – nalyd88
    Commented May 7, 2020 at 13:31

2 Answers 2

1

You can't really remap the CapsLock key in Vim, since the CapsLock key is typically undetectable from applications.

If you're on Mac OS and you have a fairly recent version of Mac OS X, then you can remap Caps Lock to Esc on the OS Preferences, as described in this answer.

If you're on a different OS and would like to remap CapsLock to Esc (or to Control), there should be ways to do that, either search for it online or ask a question about it on a more appropriate Stack Exchange site where OS keyboard mappings will be on topic. Super User comes to mind.

2

I like using j and then k entered quickly. To map I have this in my .vimrc file.

inoremap jk <esc>

It's really easy to learn to use those together.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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