Created
February 25, 2017 14:12
-
-
Save kamilglod/9d9cd1eca54025a0ab44208baa74ec41 to your computer and use it in GitHub Desktop.
Example how to create a keymapping for Atom to insert custom text line like debugger
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
addCodeLine = (code) -> | |
editor = atom.workspace.getActivePaneItem() | |
cursors = editor.getCursors(); | |
cursors[0].moveToFirstCharacterOfLine(); | |
cursors[0].moveToFirstCharacterOfLine(); | |
editor.insertText(code, options = { | |
"autoIndentNewline": true, | |
"autoIndent": true | |
}) | |
atom.commands.add 'atom-text-editor', | |
'custom:python-pdb': -> addCodeLine "import ipdb; ipdb.set_trace()\n" | |
'custom:js-debugger': -> addCodeLine "debugger;\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment