From 22a53ac52794a1980d8f733c61468e13f709d447 Mon Sep 17 00:00:00 2001 From: pupbrained Date: Sat, 5 Oct 2024 20:28:10 -0400 Subject: [PATCH] oops --- .gitignore | 1 + config.org | 90 +++++++++++++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.gitignore b/.gitignore index 8609e06..22c9f22 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ elpaca/ recentf transient/ undo/ +lsp-bridge/ amx-items config.el tramp diff --git a/config.org b/config.org index 64a2281..dfefc2a 100644 --- a/config.org +++ b/config.org @@ -178,7 +178,13 @@ (setq-local indent-tabs-mode nil)) (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)) (add-hook 'prog-mode-hook 'whitespace-mode) @@ -191,9 +197,7 @@ :ensure t :config (general-define-key - :states '(normal visual emacs) - :keymaps 'override - "K" '(eldoc-box-help-at-point :wk "Hover"))) + :states '(normal visual emacs))) (use-package evil-collection :ensure t @@ -205,10 +209,11 @@ :config (global-evil-leader-mode) (setq evil-leader/leader "") - (evil-leader/set-key "a" #'eglot-code-actions) (evil-leader/set-key "bb" #'switch-to-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 :ensure t @@ -222,35 +227,51 @@ ** LSP -*** Eglot +*** LSP-Bridge #+begin_src emacs-lisp - (use-package eglot - :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 + (use-package yasnippet :ensure t - :config - (setq eldoc-idle-delay 0 - eldoc-message-function #'ignore)) + :init + (yas-global-mode 1)) + + (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 *** TreeSitter @@ -396,9 +417,10 @@ ** Direnv #+begin_src emacs-lisp - (use-package direnv + (use-package envrc + :ensure t :config - (direnv-mode)) + (envrc-global-mode)) #+end_src ** Better M-x