Skip to content

Instantly share code, notes, and snippets.

@ninjaPixel
Last active March 29, 2017 13: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 ninjaPixel/2e69119429e70ffb8d8688a7e4eb3981 to your computer and use it in GitHub Desktop.
Save ninjaPixel/2e69119429e70ffb8d8688a7e4eb3981 to your computer and use it in GitHub Desktop.
Atom copy paste line shortcuts
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to make opened Markdown files always be soft wrapped:
#
# path = require 'path'
#
# atom.workspaceView.eachEditorView (editorView) ->
# editor = editorView.getEditor()
# if path.extname(editor.getPath()) is '.md'
# editor.setSoftWrap(true)
atom.commands.add 'atom-text-editor', 'custom:copy-paste-line', ->
editor = atom.views.getView(atom.workspace.getActiveTextEditor())
return unless editor
atom.commands.dispatch(editor, 'editor:select-line')
atom.commands.dispatch(editor, 'core:copy')
atom.commands.dispatch(editor, 'core:paste')
atom.commands.dispatch(editor, 'core:paste')
atom.commands.dispatch(editor, 'core:move-up')
atom.commands.dispatch(editor, 'editor:move-to-end-of-screen-line')
atom.commands.add 'atom-text-editor', 'custom:copy-comment-paste-line', ->
editor = atom.views.getView(atom.workspace.getActiveTextEditor())
return unless editor
atom.commands.dispatch(editor, 'editor:select-line')
atom.commands.dispatch(editor, 'core:copy')
atom.commands.dispatch(editor, 'core:paste')
atom.commands.dispatch(editor, 'core:move-up')
atom.commands.dispatch(editor, 'editor:toggle-line-comments')
atom.commands.dispatch(editor, 'core:move-down')
atom.commands.dispatch(editor, 'core:paste')
atom.commands.dispatch(editor, 'core:move-up')
atom.commands.dispatch(editor, 'editor:move-to-end-of-screen-line')
atom.commands.add 'atom-text-editor', 'custom:lint-fix', ->
editor = atom.views.getView(atom.workspace.getActiveTextEditor())
return unless editor
atom.commands.dispatch(editor, 'core:save')
atom.commands.dispatch(editor, 'linter-eslint:fix-file')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment