evilified: Generalize fix for key binding passthrough in visual state

This commit is contained in:
syl20bnr 2015-05-02 00:38:48 -04:00
parent 8a7eb23ae7
commit 113c3bfc58
2 changed files with 11 additions and 10 deletions

View file

@ -221,14 +221,6 @@
(progn
(setq magit-last-seen-setup-instructions "1.4.0"
magit-completing-read-function 'magit-ido-completing-read)
(defun spacemacs/magit-status ()
"Open a magit status buffer"
(interactive)
(call-interactively 'magit-status)
(evil-surround-mode -1)
(evil-define-key 'visual magit-status-mode-map (kbd "s") 'magit-stage-item))
;; On Windows, we must use Git GUI to enter username and password
;; See: https://github.com/magit/magit/wiki/FAQ#windows-cannot-push-via-https
(when (eq window-system 'w32)
@ -236,7 +228,7 @@
(evil-leader/set-key
"gb" 'magit-blame-mode
"gl" 'magit-log
"gs" 'spacemacs/magit-status
"gs" 'magit-status
"gC" 'magit-commit)
(evilify magit-commit-mode magit-commit-mode-map
(kbd "C-j") 'magit-goto-next-section

View file

@ -42,7 +42,16 @@
:tag " <Ev> "
:enable (emacs)
:message "-- EVILIFIED BUFFER --"
:cursor box)
:cursor box
(when (evil-evilified-state-p)
(when (bound-and-true-p evil-surround-mode)
(evil-surround-mode -1))
(setq-local evil-normal-state-map (cons 'keymap nil))
(setq-local evil-visual-state-map (cons 'keymap nil))
(add-hook 'evil-visual-state-entry-hook
(lambda () (interactive)
(local-set-key evil-visual-state-map "y" 'evil-yank))
nil 'local)))
;; default key bindings for all evilified buffers
(define-key evil-evilified-state-map (kbd dotspacemacs-leader-key)