Search code examples
macosvimkeymapping

Globally Map "Escape Key" to "jj" in vim (mac)


I have been using vim for awhile but I have not been able to figure out how to map the escape globally - every time I open a file, I have to map the escape key to jj like this:

:imap jj <Esc>

Is there a way to change the runtime defaults so that Esc is already mapped to jj?

I found the default.vim file, but you cannot edit it on a mac (with standard mac software). Should I download something to edit this file? Is there another easier way?

Any help is much appreciated!


Solution

  • The place for your local changes is called .vimrc and you typically create one in your home directory with the commands you want to execute on startup.

    Run vimtutor on the (system) command line and spend a few minutes learning how to use this editor. Then dig into the facilities provided by :help in Vim. E.g. run :help vimrc in Vim.