From 28c5298f4c7db38561248db60b24b1d6384a6f76 Mon Sep 17 00:00:00 2001 From: person808 Date: Thu, 1 Oct 2015 20:26:29 -1000 Subject: [PATCH] Use built-in evil variable to set Y behavior. --- core/core-dotspacemacs.el | 2 +- layers/+distribution/spacemacs-base/packages.el | 17 ++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/core/core-dotspacemacs.el b/core/core-dotspacemacs.el index 0f1141afb..f7ce46f5a 100644 --- a/core/core-dotspacemacs.el +++ b/core/core-dotspacemacs.el @@ -120,7 +120,7 @@ size to make separators look not too crappy.") By default the command key is `:' so ex-commands are executed like in Vim with `:' and Emacs commands are executed with ` :'.") -(defvar dotspacemacs-remap-Y-to-y$ t +(defvaralias 'dotspacemacs-remap-Y-to-y$ 'evil-want-Y-yank-to-eol "If non nil `Y' is remapped to `y$'.") (defvar dotspacemacs-use-ido nil diff --git a/layers/+distribution/spacemacs-base/packages.el b/layers/+distribution/spacemacs-base/packages.el index 0e4e46460..fabfeefd3 100644 --- a/layers/+distribution/spacemacs-base/packages.el +++ b/layers/+distribution/spacemacs-base/packages.el @@ -141,6 +141,7 @@ ;; don't display eldoc on modeline (spacemacs|hide-lighter eldoc-mode)))) + (defun spacemacs-base/init-evil () (use-package evil :init @@ -162,9 +163,9 @@ do (eval `(defface ,(intern (format "spacemacs-%s-face" state)) `((t (:background ,color - :foreground ,(face-background 'mode-line) - :box ,(face-attribute 'mode-line :box) - :inherit 'mode-line))) + :foreground ,(face-background 'mode-line) + :box ,(face-attribute 'mode-line :box) + :inherit 'mode-line))) (format "%s state face." state) :group 'spacemacs)) (eval `(setq ,(intern (format "evil-%s-state-cursor" state)) @@ -218,16 +219,6 @@ (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))) - (when dotspacemacs-remap-Y-to-y$ - (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)