How to :imap jk <Esc> Everywhere Outside VIM
It is impossible for me to write code without vim mode and this mapping. This post is a reminder on how do this mapping in: bash, jupyter notebook, joplin, and vscode.
Git Bash (Windows)*
Put this in your ~/.bashrc:
set -o vi
bind '"jk":vi-movement-mode' # map jk to <esc>
This is the same as bash on unix or mac.
To find where your ~ (home) directory is, simpley open Git Bash and run:
$ cd
$ pwd
<your home directory will be printed here>
Visual Studio Code*
In VS Code, open the Command Palette and search for "Preferences: Open Settings (JSON)".
Enter the following:
{
"vim.insertModeKeyBindings": [
{
"before": ["j", "k"],
"after": ["<Esc>"]
}
]
}
You may also enjoy turning on relative line numbering:
{
"vim.smartRelativeLine": true
}
Joplin (Mac Desktop app)*
I switched from Evernote to Joplin near the end of 2020, because Evernote stopped supporting local-only notebooks.
After enabling vim mode in the settings, type this while in the markdown editor:
:imap jk <Esc>
Note that you will need to do this manually everytime you open the Joplin app.