switch to lsp-bridge

This commit is contained in:
Mars 2024-10-05 20:26:18 -04:00
parent 789968fef9
commit 94a067fe55
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895
2 changed files with 57 additions and 34 deletions

View file

@ -178,7 +178,13 @@
(setq-local indent-tabs-mode nil)) (setq-local indent-tabs-mode nil))
(add-hook 'prog-mode-hook 'my-set-indent-width) (add-hook 'prog-mode-hook 'my-set-indent-width)
(add-hook 'org-mode-hook 'my-set-indent-width) (defun my-org-src-edit-hook ()
"Set indent width for Org source blocks."
(setq indent-tabs-mode nil) ;; Use spaces instead of tabs
(setq tab-width 2)) ;; Set tab width to your desired value
(add-hook 'org-src-mode-hook 'my-org-src-edit-hook)
(setq-default whitespace-style '(face spaces empty tabs trailing space-mark tab-mark)) (setq-default whitespace-style '(face spaces empty tabs trailing space-mark tab-mark))
(add-hook 'prog-mode-hook 'whitespace-mode) (add-hook 'prog-mode-hook 'whitespace-mode)
@ -191,9 +197,7 @@
:ensure t :ensure t
:config :config
(general-define-key (general-define-key
:states '(normal visual emacs) :states '(normal visual emacs)))
:keymaps 'override
"K" '(eldoc-box-help-at-point :wk "Hover")))
(use-package evil-collection (use-package evil-collection
:ensure t :ensure t
@ -205,10 +209,11 @@
:config :config
(global-evil-leader-mode) (global-evil-leader-mode)
(setq evil-leader/leader "<SPC>") (setq evil-leader/leader "<SPC>")
(evil-leader/set-key "a" #'eglot-code-actions)
(evil-leader/set-key "bb" #'switch-to-buffer) (evil-leader/set-key "bb" #'switch-to-buffer)
(evil-leader/set-key "bd" #'kill-this-buffer) (evil-leader/set-key "bd" #'kill-this-buffer)
(evil-leader/set-key "e" #'dirvish-side)) (evil-leader/set-key "e" #'dirvish-side)
(evil-leader/set-key "N" #'lsp-bridge-diagnostic-jump-prev)
(evil-leader/set-key "n" #'lsp-bridge-diagnostic-jump-next))
(use-package catppuccin-theme (use-package catppuccin-theme
:ensure t :ensure t
@ -222,35 +227,51 @@
** LSP ** LSP
*** Eglot *** LSP-Bridge
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package eglot (use-package yasnippet
:hook
(prog-mode . eglot-ensure)
:config
(add-hook 'emacs-lisp-mode-hook 'eglot-ensure)
(add-hook 'c-mode-hook 'hide-ifdef-mode)
(add-hook 'c++-mode-hook 'hide-ifdef-mode))
(setq-default eglot-workspace-configuration
'((haskell
(plugin
(stan
(globalOn . :json-false)))))) ;; disable stan
(defun my/eglot-format-buffer-on-save ()
"Format the current buffer if Eglot is active."
(when (bound-and-true-p eglot--managed-p)
(eglot-format-buffer)))
(add-hook 'before-save-hook #'my/eglot-format-buffer-on-save)
(use-package eldoc-box
:ensure t :ensure t
:config :init
(setq eldoc-idle-delay 0 (yas-global-mode 1))
eldoc-message-function #'ignore))
(use-package lsp-bridge
:ensure '(lsp-bridge :type git :host github :repo "manateelazycat/lsp-bridge" :files (:defaults "*"))
:init
(defun my/lsp-bridge-find-def ()
(interactive)
(let ((prev-marker (point-marker)))
(lsp-bridge-find-def)
(xref-push-marker-stack prev-marker)))
(defun lsp-bridge-mode-hook-func ()
(with-eval-after-load 'corfu (corfu-mode -1))
(local-set-key (kbd "M-[") #'lsp-bridge-return-from-def)
(local-set-key (kbd "M-]") #'lsp-bridge-find-def)
(local-set-key [remap xref-find-definitions] #'lsp-bridge-find-def)
(local-set-key [remap xref-find-definitions-other-window] #'lsp-bridge-find-def-other-window)
(local-set-key [remap xref-find-references] #'lsp-bridge-find-references)
(evil-define-key 'normal 'local (kbd "gd") #'lsp-bridge-find-def)
(evil-define-key 'normal 'local (kbd "gD") #'lsp-bridge-find-def-other-window)
(evil-define-key 'normal 'local (kbd "gi") #'lsp-bridge-find-impl)
(evil-define-key 'normal 'local (kbd "gI") #'lsp-bridge-find-impl-other-window)
(evil-define-key 'normal 'local (kbd "gr") #'lsp-bridge-find-references)
(evil-define-key 'normal 'local (kbd "K") #'lsp-bridge-popup-documentation))
(setq lsp-bridge-enable-log nil
acm-enable-icon t
acm-enable-doc t
acm-enable-tabnine nil
acm-enable-quick-access t)
(require 'lsp-bridge)
(evil-set-initial-state 'lsp-bridge-ref-mode 'insert)
(add-hook 'lsp-bridge-mode-hook #'lsp-bridge-mode-hook-func)
;; Enable lsp-bridge.
(add-hook 'c++-mode-hook #'lsp-bridge-mode))
#+end_src #+end_src
*** TreeSitter *** TreeSitter
@ -396,9 +417,10 @@
** Direnv ** Direnv
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package direnv (use-package envrc
:ensure t
:config :config
(direnv-mode)) (envrc-global-mode))
#+end_src #+end_src
** Better M-x ** Better M-x

View file

@ -0,0 +1 @@
f6ce1f9f-ddcf-4fc8-a7a0-7fd5b5d44d62