Last active
April 2, 2016 19:12
-
-
Save benwells/60180bac6a27dcb309b28faa98b9c485 to your computer and use it in GitHub Desktop.
Override escape with jk for use with atom's vim-mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.atom/init.coffee | |
atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-preceded-by-j': (e) -> | |
editor = @getModel() | |
pos = editor.getCursorBufferPosition() | |
range = [pos.traverse([0,-1]), pos] | |
lastChar = editor.getTextInBufferRange(range) | |
if lastChar != "j" | |
e.abortKeyBinding() | |
else | |
editor.backspace() | |
atom.commands.dispatch(e.currentTarget, 'vim-mode:activate-normal-mode') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'atom-text-editor.vim-mode.insert-mode': | |
'k': 'exit-insert-mode-if-preceded-by-j' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment