Compare commits

..

5 commits

Author SHA1 Message Date
janis 9b7413332e fix copilot keybindings 2025-09-03 01:00:45 +02:00
Janis b11532d1c6 Revert "more labels for keybinds"
This reverts commit 39788efd91.
2025-08-24 21:10:19 +02:00
Janis 39788efd91 more labels for keybinds 2025-08-24 18:02:09 +02:00
Janis bfffd7c555 rust-analyzer and lsp working kinda-sorta with direnv 2025-08-24 17:36:12 +02:00
Janis 9697393a2e keybindings with labels, disable posframe for consult rg/lsp find xrefs
- Updated keybindings to include descriptive labels for commands.
- Introduced `nemo/exec-without-posframe` for temporary disabling of `vertico-posframe-mode`.
- Added `nemo/consult-line`, `nemo/consult-ripgrep`, and `nemo/consult-ripgrep-dir` functions.
- Re-enabled and configured `consult-lsp` package for LSP-related commands.
2025-08-24 17:35:17 +02:00
2 changed files with 1312 additions and 46 deletions

1272
init.el

File diff suppressed because it is too large Load diff

View file

@ -523,12 +523,10 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
"wd" #'delete-window "wd" #'delete-window
"wo" #'delete-other-windows "wo" #'delete-other-windows
"ff" #'find-file "ff" #'find-file
"fi" #'nemo/edit-init-org "fi" '("Edit init.org" . nemo/edit-init-org)
"fs" #'save-buffer "fs" '("Save" . save-buffer)
"fr" #'consult-ripgrep "fr" '("rg" . consult-ripgrep)
"fR" (lambda () (interactive) "fR" '("rg in dir" . nemo/consult-ripgrep-dir)
(let ((dir (read-directory-name "Ripgrep directory: ")))
(consult-ripgrep dir)))
) )
) )
#+end_src #+end_src
@ -1102,7 +1100,6 @@ Use the =move-text= package to move the current line or selection up or down wit
read-file-name-completion-ignore-case t) read-file-name-completion-ignore-case t)
(vertico-multiform-mode) (vertico-multiform-mode)
) )
#+end_src #+end_src
Use =vertico-posframe= to make the =vertico= buffer floating in the centre of the frame. Use =vertico-posframe= to make the =vertico= buffer floating in the centre of the frame.
@ -1117,6 +1114,9 @@ Use =vertico-posframe= to make the =vertico= buffer floating in the centre of th
vertico-multiform-commands vertico-multiform-commands
'((consult-line (:not posframe)) '((consult-line (:not posframe))
(consult-ripgrep (:not posframe)) (consult-ripgrep (:not posframe))
(nemo/consult-ripgrep (:not posframe))
(nemo/consult-ripgrep-dir (:not posframe))
(lsp-find-references (:not posframe))
(embark-act (:not posframe)) (embark-act (:not posframe))
(t posframe)) (t posframe))
)) ))
@ -1143,17 +1143,27 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
#+end_src #+end_src
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun my-consult-line-wrapper () (defun nemo/exec-without-posframe (fn &rest args)
(interactive) "Execute FN with ARGS while temporarily disabling vertico-posframe-mode."
(vertico-posframe-mode -1) (vertico-posframe-mode -1)
(consult-line) (unwind-protect
(vertico-posframe-mode 1)) (apply fn args)
(vertico-posframe-mode 1)))
(defun my-consult-ripgrep-wrapper () (defun nemo/consult-line ()
(interactive) (interactive)
(vertico-posframe-mode -1) (nemo/exec-without-posframe #'consult-line))
(consult-ripgrep)
(vertico-posframe-mode 1)) (defun nemo/consult-ripgrep (&rest args)
(interactive)
(apply #'consult-ripgrep args))
(defun nemo/consult-ripgrep-dir ()
"Call consult-ripgrep in a user-specified directory."
(interactive)
(let ((dir (read-directory-name "Ripgrep directory: ")))
(consult-ripgrep dir))
)
(bind-key "C-s" 'consult-line custom-bindings-map) (bind-key "C-s" 'consult-line custom-bindings-map)
(bind-key "C-M-s" 'consult-ripgrep custom-bindings-map) (bind-key "C-M-s" 'consult-ripgrep custom-bindings-map)
@ -1433,21 +1443,21 @@ Use =inheritenv= and =envrc= to load ~.envrc~ direnv files:
:after (org markdown-mode) :after (org markdown-mode)
:general :general
(leader-def (leader-def
"cg" #'copilot-chat-insert-commit-message "cg" '("Generate commit message" . copilot-chat-insert-commit-message)
"cG" #'copilot-chat-regenerate-commit-message "cG" '("Regenerate commit message" . copilot-chat-regenerate-commit-message)
"cC" #'copilot-chat-display "cC" '("Open Copilot Chat" . copilot-chat-display)
"cba" #'copilot-chat-add-current-buffer "cba" '("Add Buffer to Copilot" . copilot-chat-add-current-buffer)
"cbd" #'copilot-chat-del-current-buffer "cbd" '("Remove Buffer from Copilot" . copilot-chat-del-current-buffer)
"cbw" #'copilot-chat-add-workspace "cbw" '("Add Workspace to Copilot" . copilot-chat-add-workspace)
"cbf" #'copilot-chat-add-file "cbf" #'copilot-chat-add-file
"cbb" #'copilot-chat-list "cbb" '("List Buffers visible to Copilot" . copilot-chat-list)
"cch" #'copilot-chat-hide "cch" #'copilot-chat-hide
"ccx" #'copilot-chat-reset "ccx" #'copilot-chat-reset
"ccb" #'copilot-chat-switch-to-buffer "ccb" #'copilot-chat-switch-to-buffer
"ccd" #'copilot-chat-doc "ccd" #'copilot-chat-doc
"ccr" #'copilot-chat-review "ccr" #'copilot-chat-review
"ccm" #'copilot-chat-set-model "ccm" #'copilot-chat-set-model
"cy" #'copilot-chat-yank "cy" '("Past latest code block" . copilot-chat-yank)
) )
) )
#+end_src #+end_src
@ -1587,12 +1597,13 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
(use-package lsp-mode (use-package lsp-mode
:straight t :straight t
:defer t :defer t
:hook (prog-mode . lsp) :hook (prog-mode . lsp-deferred)
:hook (lsp-mode . lsp-enable-which-key-integration) :hook (lsp-mode . lsp-enable-which-key-integration)
:hook (lsp-mode . lsp-inlay-hints-mode) :hook (lsp-mode . lsp-inlay-hints-mode)
:init :init
(setq lsp-keymap-prefix "C-l") (setq lsp-keymap-prefix "C-l")
(add-to-list 'completion-at-point-functions #'lsp-completion-at-point) (add-to-list 'completion-at-point-functions #'lsp-completion-at-point)
;; (advice-add 'lsp :before #'envrc-reload)
:commands lsp :commands lsp
:general-config :general-config
(leader-def (leader-def
@ -1618,6 +1629,7 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
lsp-rust-analyzer-binding-mode-hints t lsp-rust-analyzer-binding-mode-hints t
lsp-rust-analyzer-display-closure-return-type-hints t lsp-rust-analyzer-display-closure-return-type-hints t
lsp-rust-analyzer-server-format-inlay-hints t lsp-rust-analyzer-server-format-inlay-hints t
lsp-rust-analyzer-cargo-extra-env ["RUSTFLAGS", "-Clinker=clang -Clink-arg=-fuse-ld=mold"]
lsp-enable-suggest-server-download nil) lsp-enable-suggest-server-download nil)
@ -1625,18 +1637,18 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
(add-to-list 'lsp-language-id-configuration '("CMakeLists.txt" . "cmake")) (add-to-list 'lsp-language-id-configuration '("CMakeLists.txt" . "cmake"))
) )
;; (use-package consult-lsp (use-package consult-lsp
;; :straight t :straight t
;; :general :general
;; (with-eval-after-load 'lsp-mode (with-eval-after-load 'lsp-mode
;; (general-define-key (general-define-key
;; :keymaps 'lsp-command-map :keymaps 'lsp-command-map
;; "c s" '("Symbols" . consult-lsp-symbols) "c s" '("Symbols" . consult-lsp-symbols)
;; "c f" '("Symbols" . consult-lsp-file-symbols) "c f" '("Symbols" . consult-lsp-file-symbols)
;; "c d" '("Diagnostics" . consult-lsp-diagnostics) "c d" '("Diagnostics" . consult-lsp-diagnostics)
;; ) )
;; ) )
;; ) )
(use-package lsp-treemacs (use-package lsp-treemacs
:straight t :straight t
@ -2010,7 +2022,7 @@ delimiters < and >'s."
rustic-format-on-save nil rustic-format-on-save nil
;; rustic-format-trigger 'on-save ;; rustic-format-trigger 'on-save
;; rustic-format-on-save-method #'rustic-format-buffer ;; rustic-format-on-save-method #'rustic-format-buffer
rustic-analyzer-command '("/usr/bin/rust-analyzer") ;; rustic-analyzer-command '("/usr/bin/rust-analyzer")
) )
;; (setq nemo/lsp-format-on-save t) ;; (setq nemo/lsp-format-on-save t)
) )