all repos — nixfiles @ d2db2799c625d163bbe54500854fc73ec350e574

System and user configuration, managed by nix and home-manager

emacs: make <leader>j jump to {lsp,eglot} symbol intelligently

Alan Pearce
commit

d2db2799c625d163bbe54500854fc73ec350e574

parent

0abb318c351a8bdb6cac8998d737bd81340cb0c0

2 files changed, 12 insertions(+), 1 deletion(-)

jump to
M user/emacs/init.eluser/emacs/init.el
@@ -1045,6 +1045,10 @@ (defvaralias 'go-ts-mode-hook 'go-mode-hook)
(defvaralias 'nix-ts-mode-hook 'nix-mode-hook) +(use-package consult-lsp + :commands (consult-lsp-symbols + consult-lsp-diagnostics)) + (use-package eglot :defer 3 :general (:states 'normal :keymaps 'eglot-mode-map
@@ -1142,6 +1146,12 @@ (if lsp-mode
(call-interactively #'lsp-rename) (call-interactively #'eglot-rename))) +(defun my/ls-consult-symbol () + (interactive) + (if lsp-mode + (call-interactively #'consult-lsp-symbols) + (call-interactively #'consult-eglot-symbols))) + ;; Inside a javascript project, it's common to install tools locally to ;; the project. This will allows emacs to find their executables.
@@ -1199,7 +1209,7 @@ "h" '(:keymap ehelp-map :package ehelp)
"w" '(:keymap evil-window-map :package evil) "x" '(:keymap ctl-x-map) "c" (general-simulate-key "C-c") - "j" #'consult-eglot-symbols + "j" #'my/ls-consult-symbol "r" #'my/ls-rename "q" #'evil-delete-buffer "p" '(:keymap project-prefix-map :package project)
M user/settings/emacs.nixuser/settings/emacs.nix
@@ -81,6 +81,7 @@ consult
consult-dir consult-ghq consult-eglot + consult-lsp crux dired-git-info docker-compose-mode