Last active
May 1, 2018 21:44
-
-
Save abe33/6685d1581d73fd46fe4e to your computer and use it in GitHub Desktop.
Scrolling Atom editors without moving the cursor
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
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) |
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
'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