Skip to content

Instantly share code, notes, and snippets.

@drbraden
Last active August 29, 2015 14:11
Show Gist options
  • Save drbraden/9be3000b1e381e159632 to your computer and use it in GitHub Desktop.
Save drbraden/9be3000b1e381e159632 to your computer and use it in GitHub Desktop.
How to remap "jj" or "jk" to Escape in Atom when using vim-mode
# Built from a couple of comments at https://github.com/atom/vim-mode/issues/334
# In ~/.atom/init.coffee
atom.workspaceView.command 'insert-incomplete-keybinding', (e)->
if oe = e.originalEvent && e.originalEvent.originalEvent
char = String.fromCharCode(oe.which)
char = char.toLowerCase() unless oe.shift
atom.workspace.activePaneItem.insertText(char)
# In ~/.atom/keymap.cson
'.editor.vim-mode.insert-mode':
'j': 'insert-incomplete-keybinding'
# I prefer jj
'.vim-mode.insert-mode:not(.mini)':
'j j': 'vim-mode:activate-command-mode'
# Others prefer jk
#'.vim-mode.insert-mode:not(.mini)':
# 'j k': 'vim-mode:activate-command-mode'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment