[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/evil 00bd297150: Add evil-scroll-end-column & evil-scroll-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/evil 00bd297150: Add evil-scroll-end-column & evil-scroll-start-column |
Date: |
Sat, 14 Jan 2023 10:59:09 -0500 (EST) |
branch: elpa/evil
commit 00bd29715028b06384435f053a36b6e994f1d1d7
Author: Tom Dalziel <tom_dl@hotmail.com>
Commit: Tom Dalziel <33435574+tomdl89@users.noreply.github.com>
Add evil-scroll-end-column & evil-scroll-start-column
---
evil-commands.el | 26 ++++++++++++++++++++++++++
evil-maps.el | 2 ++
2 files changed, 28 insertions(+)
diff --git a/evil-commands.el b/evil-commands.el
index 5816d8a721..e6c1c10fd6 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -1188,6 +1188,32 @@ or line COUNT to the bottom of the window."
(evil-with-hproject-point-on-window
(scroll-left count)))
+(evil-define-command evil-scroll-end-column ()
+ "Scroll the window to position the cursor at the end (right side) of the
screen.
+Warn if `hscroll-margin' > 0, as cursor will be `hscroll-margin' chars from
+the right edge."
+ :repeat nil
+ :keep-visual t
+ (interactive)
+ (let* ((window-hpos (- (current-column) (window-hscroll)))
+ (dist-from-right-edge (- (window-width) window-hpos)))
+ (when (< 0 hscroll-margin)
+ (message "%s: hscroll-margin = %d" this-command hscroll-margin))
+ (evil-scroll-column-left (- dist-from-right-edge (abs (* 2
hscroll-margin))))))
+
+(evil-define-command evil-scroll-start-column ()
+ "Scroll the window to position the cursor at the start (left side) of the
screen.
+Warn if `hscroll-margin' > 0, as cursor will be `hscroll-margin' chars from
+the left edge."
+ :repeat nil
+ :keep-visual t
+ (interactive)
+ (let ((initial-column (current-column))
+ (initial-hscroll (window-hscroll)))
+ (when (< 0 hscroll-margin)
+ (message "%s: hscroll-margin = %d" this-command hscroll-margin))
+ (evil-scroll-column-right (- initial-column initial-hscroll hscroll-margin
1))))
+
;;; Text objects
;; Text objects are defined with `evil-define-text-object'. In Visual
diff --git a/evil-maps.el b/evil-maps.el
index 4c4d141e76..8d39d5d0b8 100644
--- a/evil-maps.el
+++ b/evil-maps.el
@@ -319,6 +319,8 @@
(define-key evil-motion-state-map [?z right] 'evil-scroll-column-right)
(define-key evil-motion-state-map "zh" 'evil-scroll-column-left)
(define-key evil-motion-state-map [?z left] 'evil-scroll-column-left)
+(define-key evil-motion-state-map "ze" 'evil-scroll-end-column)
+(define-key evil-motion-state-map "zs" 'evil-scroll-start-column)
(define-key evil-motion-state-map
(read-kbd-macro evil-toggle-key) 'evil-emacs-state)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/evil 00bd297150: Add evil-scroll-end-column & evil-scroll-start-column,
ELPA Syncer <=