Last active
August 29, 2015 14:20
-
-
Save bangedorrunt/ada61d690942ffaf345a to your computer and use it in GitHub Desktop.
Custom Binding Key Map for Atom Editor
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
# | |
init.coffee | |
atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-proceeded-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') | |
atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-proceeded-by-o': (e) -> | |
atom.commands.dispatch(e.currentTarget, 'vim-mode:insert-below-with-newline') | |
atom.commands.dispatch(e.currentTarget, 'vim-mode:activate-mormal-mode') | |
atom.commands.add 'atom-text-editor', 'exit-insert-mode-if-proceeded-by-shift-o': (e) -> | |
atom.commands.dispatch(e.currentTarget, 'vim-mode:insert-above-with-newline') | |
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
# keymap.cson | |
'atom-text-editor.vim-mode.insert-mode': | |
'k': 'exit-insert-mode-if-proceeded-by-j' | |
'atom-text-editor.vim-mode.command-mode': | |
'shift-O': 'exit-insert-mode-if-proceeded-by-shift-o' | |
'o': 'exit-insert-mode-if-proceeded-by-o' |
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
# keymap.cson | |
# Work with Atom +1.05 | |
'atom-text-editor.vim-mode.insert-mode': | |
'j j': 'vim-mode:activate-normal-mode' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment