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.
This commit is contained in:
Janis 2025-08-24 17:35:17 +02:00
parent 1bdb5ed156
commit 9697393a2e

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
"wo" #'delete-other-windows
"ff" #'find-file
"fi" #'nemo/edit-init-org
"fs" #'save-buffer
"fr" #'consult-ripgrep
"fR" (lambda () (interactive)
(let ((dir (read-directory-name "Ripgrep directory: ")))
(consult-ripgrep dir)))
"fi" '("Edit init.org" . nemo/edit-init-org)
"fs" '("Save" . save-buffer)
"fr" '("rg" . consult-ripgrep)
"fR" '("rg in dir" . nemo/consult-ripgrep-dir)
)
)
#+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)
(vertico-multiform-mode)
)
#+end_src
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
'((consult-line (: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))
(t posframe))
))
@ -1143,17 +1143,27 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
#+end_src
#+begin_src emacs-lisp
(defun my-consult-line-wrapper ()
(interactive)
(defun nemo/exec-without-posframe (fn &rest args)
"Execute FN with ARGS while temporarily disabling vertico-posframe-mode."
(vertico-posframe-mode -1)
(consult-line)
(vertico-posframe-mode 1))
(unwind-protect
(apply fn args)
(vertico-posframe-mode 1)))
(defun my-consult-ripgrep-wrapper ()
(defun nemo/consult-line ()
(interactive)
(vertico-posframe-mode -1)
(consult-ripgrep)
(vertico-posframe-mode 1))
(nemo/exec-without-posframe #'consult-line))
(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-M-s" 'consult-ripgrep custom-bindings-map)
@ -1625,18 +1635,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"))
)
;; (use-package consult-lsp
;; :straight t
;; :general
;; (with-eval-after-load 'lsp-mode
;; (general-define-key
;; :keymaps 'lsp-command-map
;; "c s" '("Symbols" . consult-lsp-symbols)
;; "c f" '("Symbols" . consult-lsp-file-symbols)
;; "c d" '("Diagnostics" . consult-lsp-diagnostics)
;; )
;; )
;; )
(use-package consult-lsp
:straight t
:general
(with-eval-after-load 'lsp-mode
(general-define-key
:keymaps 'lsp-command-map
"c s" '("Symbols" . consult-lsp-symbols)
"c f" '("Symbols" . consult-lsp-file-symbols)
"c d" '("Diagnostics" . consult-lsp-diagnostics)
)
)
)
(use-package lsp-treemacs
:straight t