Skip to content

Instantly share code, notes, and snippets.

@kamilglod
Created February 25, 2017 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kamilglod/9d9cd1eca54025a0ab44208baa74ec41 to your computer and use it in GitHub Desktop.
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
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