Skip to content

Instantly share code, notes, and snippets.

@abe33
Last active May 1, 2018 21:44
Show Gist options
  • Save abe33/6685d1581d73fd46fe4e to your computer and use it in GitHub Desktop.
Save abe33/6685d1581d73fd46fe4e to your computer and use it in GitHub Desktop.
Scrolling Atom editors without moving the cursor
atom.commands.add 'atom-text-editor',
'editor:scroll-down': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)
newScrollTop = editorElement.getScrollTop() + editorElement.getHeight()
editorElement.setScrollTop(newScrollTop)
'editor:scroll-up': ->
editor = atom.workspace.getActiveTextEditor()
editorElement = atom.views.getView(editor)
newScrollTop = editorElement.getScrollTop() - editorElement.getHeight()
editorElement.setScrollTop(newScrollTop)
'atom-text-editor':
'ctrl-down': 'editor:scroll-down'
'ctrl-up': 'editor:scroll-up'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment