Skip to content

Instantly share code, notes, and snippets.

@mpontus
Created March 17, 2015 02:45
Show Gist options
  • Select an option

  • Save mpontus/3fe247a63118983b1f5e to your computer and use it in GitHub Desktop.

Select an option

Save mpontus/3fe247a63118983b1f5e to your computer and use it in GitHub Desktop.
(setq-default scroll-up-aggressively 0.0)
(add-hook 'post-command-hook
(defun recenter+ ()
(unless (and (symbolp this-command) (get this-command 'scroll-command))
(with-current-buffer (window-buffer)
(recenter (- (1+ (save-excursion
(vertical-motion (floor (window-screen-lines) 2))))))))))
(define-key global-map [remap scroll-down-command]
(defun move-to-top-line () (interactive) (move-to-window-line 1)))
(define-key global-map [remap scroll-up-command]
(defun move-to-bottom-line () (interactive) (move-to-window-line -1)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment