about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2018-05-29T20·25-0400
committerWilliam Carroll <wpcarro@gmail.com>2018-07-19T16·00-0400
commitc50b730dad0d59e252177b24799a00eab26b3411 (patch)
tree2e71c111f9c9ecfb182bcbe7be11e6a71082dde5
parente2891432e28faff7a0ed9835ccfe202728b7df83 (diff)
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.
-rw-r--r--emacs.d/wpc/packages/wpc-keybindings.el13
1 files changed, 13 insertions, 0 deletions
diff --git a/emacs.d/wpc/packages/wpc-keybindings.el b/emacs.d/wpc/packages/wpc-keybindings.el
index 0e74ce68bacb..d2546b3f0e94 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")