Make evil-smart* functions respect leader key.

This commit is contained in:
person808 2015-04-29 06:49:45 -10:00 committed by syl20bnr
parent 7d2f36671f
commit 8f38841082

View file

@ -677,22 +677,25 @@ Example: (evil-map visual \"<\" \"<gv\")"
(evil-map visual "<" "<gv") (evil-map visual "<" "<gv")
(evil-map visual ">" ">gv") (evil-map visual ">" ">gv")
(defun spacemacs/smart-doc-lookup () (defun spacemacs/evil-smart-doc-lookup ()
"Bind K to SPC m h h and fall back to `evil-lookup'" "Version of `evil-lookup' that attempts to use
the mode specific goto-definition binding,
i.e. `SPC m h h`, to lookup the source of the definition,
while falling back to `evil-lookup'"
(interactive) (interactive)
(condition-case nil (condition-case nil
(execute-kbd-macro (kbd "SPC m h h")) (execute-kbd-macro (kbd (concat dotspacemacs-leader-key " m h h")))
(error (evil-lookup)))) (error (evil-lookup))))
(define-key evil-normal-state-map (kbd "K") 'spacemacs/smart-doc-lookup) (define-key evil-normal-state-map (kbd "K") 'spacemacs/evil-smart-doc-lookup)
(defun spacemacs/evil-smart-goto-definition () (defun spacemacs/evil-smart-goto-definition ()
"Version of `evil-goto-definition' that attempts to use "Version of `evil-goto-definition' that attempts to use
the mode specific goto-definition binding, the mode specific goto-definition binding,
i.e. `SPC m g g`, to lookup the source of the definition, i.e. `SPC m g g`, to lookup the source of the definition,
while falling back to `evil-goto-definition'." while falling back to `evil-goto-definition'"
(interactive) (interactive)
(condition-case nil (condition-case nil
(execute-kbd-macro (kbd "SPC m g g")) (execute-kbd-macro (kbd (concat dotspacemacs-leader-key "m g g")))
(error (evil-goto-definition)))) (error (evil-goto-definition))))
(define-key evil-normal-state-map (define-key evil-normal-state-map
(kbd "gd") 'spacemacs/evil-smart-goto-definition) (kbd "gd") 'spacemacs/evil-smart-goto-definition)