aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/lisp/init-eglot.el
blob: 5409958a397763283f3ed268f76a1f90ad328a3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(defun gx/eglot-format-before-save ()
  (add-hook 'before-save-hook #'eglot-format nil t))

(defun gx/eglot-code-action-organize-imports-before-save ()
  (add-hook 'before-save-hook #'eglot-code-action-organize-imports nil t))

(with-eval-after-load 'evil
  (evil-define-key 'normal 'eglot--managed-mode
    (kbd "gd") 'xref-find-definitions
    (kbd "gr") 'xref-find-references
    (kbd "gt") 'eglot-find-typeDefinition
    (kbd "K") 'eldoc-doc-buffer
    (kbd "gi") 'eglot-find-implementation
    (kbd "C-t") 'xref-pop-marker-stack))

(setq eglot-autoreconnect t)

(with-eval-after-load 'eglot
  (setq completion-category-defaults nil))

(provide 'init-eglot)