Use built-in evil variable to set Y behavior.

This commit is contained in:
person808 2015-10-01 20:26:29 -10:00 committed by Eivind Fonn
parent 273d6b5d11
commit 28c5298f4c
2 changed files with 5 additions and 14 deletions

View File

@ -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 `<leader> :'.")
(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

View File

@ -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 "<right>") 'evil-window-right)
(define-key evil-window-map (kbd "<up>") 'evil-window-up)
(define-key evil-window-map (kbd "<down>") '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)