configs/emacs: fix eglot format-buffer stuff, add clang/rust server

This commit is contained in:
Aaron Bieber 2024-07-09 07:24:24 -06:00
parent 5d65210ca4
commit baa7ee6576
No known key found for this signature in database

View File

@ -216,9 +216,17 @@ auto-completion stuff.
(add-hook 'typescript-mode-hook 'eglot-ensure)
(add-hook 'ruby-mode-hook 'eglot-ensure)
(add-hook 'perl-mode-hook 'eglot-ensure)
(add-to-list 'eglot-server-programs '(c-mode . ("clangd")))
(add-to-list 'eglot-server-programs '(c++-mode . ("clangd")))
(add-to-list 'eglot-server-programs '(rust-mode . ("rust-analyzer")))
(define-key eglot-mode-map (kbd "C-c r") 'eglot-rename)
(define-key eglot-mode-map (kbd "C-c f") 'eglot-format)
(add-hook 'before-save-hook 'eglot-format-buffer))
:hook
(eglot-managed-mode . (lambda() (add-hook 'before-save-hook 'eglot-format-buffer nil 'local))))
#+end_src