configs/emacs: ensure eglot runs in some common modes

This commit is contained in:
Aaron Bieber 2024-05-24 20:43:35 -06:00
parent 72c2988b76
commit d8cf950caf
No known key found for this signature in database

View File

@ -179,8 +179,18 @@ Use ~eglot~ for lsp stuff. It's built in and shows a bit more information for
auto-completion stuff. auto-completion stuff.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eglot) (defun my-eglot-organize-imports () (interactive)
(eglot-code-actions nil nil "source.organizeImports" t))
(use-package eglot
:config
(add-hook 'go-mode-hook 'eglot-ensure)
(add-hook 'elm-mode-hook 'eglot-ensure)
(add-hook 'nix-mode-hook 'eglot-ensure)
(define-key eglot-mode-map (kbd "C-c r") 'eglot-rename) (define-key eglot-mode-map (kbd "C-c r") 'eglot-rename)
(add-hook 'before-save-hook 'my-eglot-organize-imports nil t)
(add-hook 'before-save-hook 'eglot-format-buffer))
#+end_src #+end_src
** company and friends ** company and friends