From 12bc72123a35959420e2043155294a6ea8348d05 Mon Sep 17 00:00:00 2001 From: person808 Date: Fri, 28 Aug 2015 17:43:47 -1000 Subject: [PATCH] Make Y equivalent to y$. This is much more consistent with C and D and is even recommended by vim itself. --- doc/DOCUMENTATION.org | 3 +++ spacemacs/packages.el | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/doc/DOCUMENTATION.org b/doc/DOCUMENTATION.org index 861b361aa..78d3f4324 100644 --- a/doc/DOCUMENTATION.org +++ b/doc/DOCUMENTATION.org @@ -694,6 +694,9 @@ Additional information may as well be displayed in the minibuffer. opposite direction in =Vim=, but in =Spacemacs= it is the major mode specific leader key by default (which can be set on another key binding in the dotfile). +- The ~Y~ key does not yank the whole line. It yanks from the current point to + the end of the line. This is more consistent with the behavior of ~C~ and ~D~ + and is also recommended by the vim documentation. Send a PR to add the differences you found in this section. diff --git a/spacemacs/packages.el b/spacemacs/packages.el index 880516894..94cdd446b 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -717,6 +717,13 @@ (define-key evil-window-map (kbd "") 'evil-window-right) (define-key evil-window-map (kbd "") 'evil-window-up) (define-key evil-window-map (kbd "") 'evil-window-down) + ;; Make Y equivalent to y$ + (defun spacemacs/evil-yank-to-end-of-line () + "Yank from point to end of line." + (interactive) + (evil-yank (point) (point-at-eol))) + (define-key evil-normal-state-map (kbd "Y") 'spacemacs/evil-yank-to-end-of-line) + (define-key evil-motion-state-map (kbd "Y") 'spacemacs/evil-yank-to-end-of-line) (evil-leader/set-key "re" 'evil-show-registers) @@ -868,14 +875,14 @@ Example: (evil-map visual \"<\" \"