Skip to content

Commit

Permalink
Fix scroll transient state
Browse files Browse the repository at this point in the history
Fixes #3450

For some reason, the scroll transient state was trying to reinvent
scrolling halfway up and down a page when these are well supported
operations in evil.
  • Loading branch information
justbur authored and TheBB committed Feb 23, 2016
1 parent e69d550 commit 17ba634
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions layers/+distribution/spacemacs-base/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -318,33 +318,19 @@ Example: (evil-map visual \"<\" \"<gv\")"
(kbd "gd") 'spacemacs/evil-smart-goto-definition)

;; scrolling transient state
(defun spacemacs/scroll-half-page-up ()
"Scroll half a page up while keeping cursor in middle of page."
(interactive)
(evil-window-top)
(let ((recenter-redisplay nil))
(recenter nil)))
(defun spacemacs/scroll-half-page-down ()
"Scroll half a page down while keeping cursor in middle of page."
(interactive)
(evil-window-bottom)
;; required to make repeated presses idempotent
(evil-next-visual-line)
(let ((recenter-redisplay nil))
(recenter nil)))
(spacemacs|define-transient-state scroll
:title "Scrolling Transient State"
:bindings
("," evil-scroll-page-up "page up")
("." evil-scroll-page-down "page down")
;; half page
("<" spacemacs/scroll-half-page-up "half page up")
(">" spacemacs/scroll-half-page-down "half page down"))
("<" evil-scroll-up "half page up")
(">" evil-scroll-down "half page down"))
(spacemacs/set-leader-keys
"n," 'spacemacs/scroll-transient-state/evil-scroll-page-up
"n." 'spacemacs/scroll-transient-state/evil-scroll-page-down
"n<" 'spacemacs/scroll-transient-state/spacemacs/scroll-half-page-up
"n>" 'spacemacs/scroll-transient-state/spacemacs/scroll-half-page-down)
"n<" 'spacemacs/scroll-transient-state/scroll-half-page-up
"n>" 'spacemacs/scroll-transient-state/scroll-half-page-down)

;; pasting transient-state
(evil-define-command spacemacs//transient-state-0 ()
Expand Down

0 comments on commit 17ba634

Please sign in to comment.