From 8938e61a525fd8b506549c7d1b18aa807f861852 Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Tue, 12 Mar 2019 23:13:11 +0530 Subject: [PATCH] init.el: Update emacs config 1. Change update interval to 4 days as it seems for a longer interval somehow finding packages on melpa runs into some issue. 2. Remove intero. It cannot even resolve a symbol in the same project. 3. Add support for dumb-jump. Seems to have better specific search focus than just git grep with helm. 4. Add key bindings for xref. We can use emacs tags which is especially helpful since LSP or intero does not work for Haskell nor does gtags. Signed-off-by: Sanchayan Maity --- init.el | 73 ++++++++++++++++++--------------------------------------- 1 file changed, 23 insertions(+), 50 deletions(-) diff --git a/init.el b/init.el index 3991606..fdbf639 100644 --- a/init.el +++ b/init.el @@ -61,7 +61,7 @@ :ensure t :config (setq auto-package-update-delete-old-versions t - auto-package-update-interval 14) + auto-package-update-interval 4) (auto-package-update-maybe)) ;; Restart emacs from within emacs @@ -115,6 +115,9 @@ (setq avy-all-windows 'all-frames) (setq avy-background t))) +(use-package dumb-jump + :ensure t) + ;; Vim mode (use-package evil :ensure t @@ -184,6 +187,7 @@ helm-gtags-prefix-key "SPC" helm-gtags-use-input-at-cursor t helm-gtags-pulse-at-cursor t) + ;; enable gtags only for C (add-hook 'c-mode-hook 'helm-gtags-mode))) ;; All The Icons @@ -361,7 +365,24 @@ "jb" 'avy-pop-mark "jj" 'evil-avy-goto-char-timer "jl" 'evil-avy-goto-line - "jw" 'evil-avy-goto-word-or-subword-1)) + "jw" 'evil-avy-goto-word-or-subword-1 + ;; dumb jump + "dg" 'dumb-jump-go + "dp" 'dump-jump-back + "dq" 'dump-jump-quick-look + "dw" 'dumb-jump-go-other-window + "de" 'dumb-jump-go-prefer-external + "do" 'dumb-jump-go-prefer-external-other-window + "dp" 'dumb-jump-go-prompt + ;; xref + "xv" 'visit-tags-table + "xd" 'xref-find-definition + "xr" 'xref-find-references + "xa" 'xref-find-appropos + "xf" 'xref-find-definitions-other-frame + "xp" 'xref-pop-marker-stack + "xq" 'xref-query-replace-in-results + "xs" 'tags-search)) (general-define-key :states '(normal visual emacs) @@ -372,33 +393,6 @@ :which-key "format declaration using hindent") "F" '(haskell-mode-stylish-buffer :which-key "format buffer using haskell stylish") - "gg" '(intero-goto-definition - :which-key "goto definition or tag") - "hi" '(intero-info - :which-key "get info for identifier under cursor") - "ht" '(intero-type-at - :which-key "get type of identifier under cursor") - "rs" '(intero-apply-suggestions) - "sb" '(intero-repl-load - :which-key "load/reload current buffer in repl") - "ic" '(intero-cd - :which-key "change directory in backend process") - "id" '(intero-devel-reload - :which-key "reload module DevelMain") - "ik" '(intero-destroy - :which-key "stop current process & kill its associated") - "il" '(intero-list-buffers - :which-key "list hidden process buffers created") - "ir" '(intero-restart - :which-key "restart process with same config") - "it" '(intero-targets - :which-key "set targets to use for stack ghci") - "sc" nil - "hT" '(haskell-intero/insert-type) - "ss" '(haskell-intero/display-repl - :which-key "show repl without switching") - "sS" '(haskell-intero/pop-to-repl - :which-key "show and switch to repl") "rb" '(hlint-refactor-refactor-buffer :which-key "apply all hlint suggestions") "rr" '(hlint-refactor-refactor-at-point @@ -686,25 +680,6 @@ (call-interactively 'git-link-commit)) (call-interactively 'git-link-commit))) -(defun haskell-intero/insert-type () - (interactive) - (intero-type-at :insert)) - -(defun haskell-intero/display-repl (&optional prompt-options) - (interactive "P") - (let ((buffer (intero-repl-buffer prompt-options))) - (unless (get-buffer-window buffer 'visible) - (display-buffer buffer)))) - -(defun haskell-intero/pop-to-repl (&optional prompt-options) - (interactive "P") - (pop-to-buffer (intero-repl-buffer prompt-options))) - -(defun haskell-intero//preserve-focus (f &rest args) - (let ((buffer (current-buffer))) - (apply f args) - (pop-to-buffer buffer))) - (defun helm-gtags-dwim-other-window () ;; Enable helm-gtags-dwim in the other window (interactive) @@ -810,8 +785,6 @@ (haskell-process-suggest-remove-import-lines t))) (use-package flycheck-haskell :defer t) -(use-package intero - :defer t) (use-package hindent :defer t) (use-package hlint-refactor