From c50b730dad0d59e252177b24799a00eab26b3411 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Tue, 29 May 2018 16:25:01 -0400 Subject: [PATCH] Support goto-definition dispatching Need to learn more about `evil-goto-definition` because it is possible and even likely that there is a known, friendlier alternative way to dispatch the goto-definition using Evil's infrastructure. Needed a hotfix, however, so this will have to suffice for now. --- emacs.d/wpc/packages/wpc-keybindings.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/emacs.d/wpc/packages/wpc-keybindings.el b/emacs.d/wpc/packages/wpc-keybindings.el index 0e74ce68b..d2546b3f0 100644 --- a/emacs.d/wpc/packages/wpc-keybindings.el +++ b/emacs.d/wpc/packages/wpc-keybindings.el @@ -12,6 +12,17 @@ :fetcher github)) (general-evil-setup t) +(defun wpc/goto-definition () + "Support a goto-definition that dispatches off of the `major-mode'." + (interactive) + (require 'flow-minor-mode) + (cond ((eq major-mode 'rjsx-mode) + (flow-minor-jump-to-definition)) + ((eq major-mode 'haskell-mode) + (intero-goto-definition)) + (t + (evil-goto-definition)))) + ;; vim... (use-package evil :general @@ -25,6 +36,8 @@ "sk" 'evil-window-split "sj" 'wpc/evil-window-split-down "sj" 'wpc/evil-window-split-down) + (n + "gd" 'wpc/goto-definition) (general-unbind m "M-." "C-p") (general-unbind n "s" "M-.") (general-unbind i "C-d" "C-a" "C-e" "C-n" "C-p" "C-k")