Skip to content

Instantly share code, notes, and snippets.

@abe33

abe33/init.coffee

Last active May 1, 2018
Embed
What would you like to do?
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