Last active
August 29, 2015 14:15
-
-
Save herbertjones/c4fca060e531fdfd5828 to your computer and use it in GitHub Desktop.
Playing with a spacemacs-like scrolling micro state
This file contains hidden or 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
;; Old syntax | |
(evil-leader/set-key | |
"," 'hfj/scroll-page-down | |
"." 'hfj/scroll-page-up | |
) | |
(defun hfj/scroll-page-overlay-map () | |
"Set a temporary overlay map to easily scroll through a file." | |
(set-temporary-overlay-map | |
(let ((map (make-sparse-keymap))) | |
(define-key map (kbd ",") 'hfj/scroll-page-down) | |
(define-key map (kbd ".") 'hfj/scroll-page-up) | |
(define-key map (kbd "SPC") '(lambda () (interactive) t)) | |
map) t)) | |
(defun hfj/scroll-page-micro-state-doc () | |
"Display a short documentation in the mini buffer." | |
(echo "Scroll Page micro-state: .: page up ,: page down")) | |
(defun hfj/scroll-page-up-or-down (direction) | |
"-1 for down, 1 for up" | |
(interactive) | |
(if (< direction 0) | |
(evil-scroll-page-down 1) | |
(evil-scroll-page-up 1)) | |
(hfj/scroll-page-overlay-map) | |
(hfj/scroll-page-micro-state-doc)) | |
(defun hfj/scroll-page-up () | |
"Micro state page up" | |
(interactive) | |
(hfj/scroll-page-up-or-down 1)) | |
(defun hfj/scroll-page-down () | |
"Micro state page down" | |
(interactive) | |
(hfj/scroll-page-up-or-down -1)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment