aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJAremko <w3techplayground@gmail.com>2016-04-06 11:55:47 +0300
committerJAremko <w3techplayground@gmail.com>2016-04-06 11:55:47 +0300
commite3bfdb6136c193a908f65a9ac3dcd3e047235f39 (patch)
treebb28b3f8e415f6a7a906793506bc155240938e82
parentadbc6d9ab6ef9d44d9f6d53e226ad1a55ca30768 (diff)
Make evil-scroll-line-* remember last count.
-rw-r--r--evil-commands.el22
-rw-r--r--evil-vars.el6
2 files changed, 22 insertions, 6 deletions
diff --git a/evil-commands.el b/evil-commands.el
index 19ab3e5..23af8ed 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -809,18 +809,28 @@ on the first non-blank character."
;; scrolling
(evil-define-command evil-scroll-line-up (count)
- "Scrolls the window COUNT lines upwards."
+ "Scrolls the window COUNT lines upwards.
+If COUNT is not specified the function scrolls down.
+`evil-scroll-line-count', which is the last used count."
:repeat nil
:keep-visual t
- (interactive "p")
- (scroll-down count))
+ (interactive "P")
+ (progn
+ (setq count (or count evil-scroll-line-count))
+ (setq evil-scroll-line-count count)
+ (scroll-down count)))
(evil-define-command evil-scroll-line-down (count)
- "Scrolls the window COUNT lines downwards."
+ "Scrolls the window COUNT lines downwards.
+If COUNT is not specified the function scrolls up
+`evil-scroll-line-count', which is the last used count."
:repeat nil
:keep-visual t
- (interactive "p")
- (scroll-up count))
+ (interactive "P")
+ (progn
+ (setq count (or count evil-scroll-line-count))
+ (setq evil-scroll-line-count count)
+ (scroll-up count)))
(evil-define-command evil-scroll-count-reset ()
"Sets `evil-scroll-count' to 0.
diff --git a/evil-vars.el b/evil-vars.el
index 234abd1..6551600 100644
--- a/evil-vars.el
+++ b/evil-vars.el
@@ -1178,6 +1178,12 @@ and `evil-scroll-down'.
Determines how many lines should be scrolled.
Default value is 0 - scroll half the screen.")
+(evil-define-local-var evil-scroll-line-count 1
+ "Holds last used prefix for `evil-scroll-line-up'
+and `evil-scroll-line-down'.
+Determines how many lines should be scrolled.
+Default value is 1 line.")
+
(evil-define-local-var evil-state nil
"The current Evil state.
To change the state, use `evil-change-state'