completion/selectrum -> completion/vertico, part 3
- Rename all functions and variables in the module to reflect the namechange (and the irc jump function)
This commit is contained in:
parent
24eaa1317c
commit
a0eb4e9b65
13 changed files with 55 additions and 55 deletions
|
@ -110,7 +110,7 @@ https://assets.doomemacs.org/completion/vertico/search-replace.png
|
|||
This module provides some in buffer searching bindings:
|
||||
|
||||
+ =SPC s s= (~isearch~)
|
||||
+ =SPC s S= (~+selectrum/search-symbol-at-point~ via ~consult-line~)
|
||||
+ =SPC s S= (~+vertico/search-symbol-at-point~ via ~consult-line~)
|
||||
+ =SPC s b= (~consult-line~)
|
||||
|
||||
https://assets.doomemacs.org/completion/vertico/buffer-search.png
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
;; completion/vertico/autoload/evil.el -*- lexical-binding: t; -*-
|
||||
;;;###if (featurep! :editor evil)
|
||||
|
||||
;;;###autoload (autoload '+selectrum:project-search "completion/vertico/autoload/evil" nil t)
|
||||
(evil-define-command +selectrum:project-search (query &optional all-files-p)
|
||||
"Ex interface for `+selectrum/project-search'."
|
||||
;;;###autoload (autoload '+vertico:project-search "completion/vertico/autoload/evil" nil t)
|
||||
(evil-define-command +vertico:project-search (query &optional all-files-p)
|
||||
"Ex interface for `+vertico/project-search'."
|
||||
(interactive "<a><!>")
|
||||
(+selectrum/project-search all-files-p query))
|
||||
(+vertico/project-search all-files-p query))
|
||||
|
||||
;;;###autoload (autoload '+selectrum:project-search-from-cwd "completion/vertico/autoload/evil" nil t)
|
||||
(evil-define-command +selectrum:project-search-from-cwd (query &optional recurse-p)
|
||||
"Ex interface for `+selectrum/project-search-from-cwd'."
|
||||
;;;###autoload (autoload '+vertico:project-search-from-cwd "completion/vertico/autoload/evil" nil t)
|
||||
(evil-define-command +vertico:project-search-from-cwd (query &optional recurse-p)
|
||||
"Ex interface for `+vertico/project-search-from-cwd'."
|
||||
(interactive "<a><!>")
|
||||
(+selectrum/project-search-from-cwd (not recurse-p) query))
|
||||
(+vertico/project-search-from-cwd (not recurse-p) query))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
;;; completion/vertico/autoload/vertico.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defadvice! +selectrum--company-capf--candidates-a (fn &rest args)
|
||||
(defadvice! +vertico--company-capf--candidates-a (fn &rest args)
|
||||
"Highlight company matches correctly, and try default completion styles before
|
||||
orderless."
|
||||
:around 'company-capf--candidates
|
||||
|
@ -10,7 +10,7 @@ orderless."
|
|||
(apply fn args)))
|
||||
|
||||
;;;###autoload
|
||||
(cl-defun +selectrum-file-search (&key query in all-files (recursive t) prompt args)
|
||||
(cl-defun +vertico-file-search (&key query in all-files (recursive t) prompt args)
|
||||
"Conduct a file search using ripgrep.
|
||||
|
||||
:query STRING
|
||||
|
@ -56,27 +56,27 @@ orderless."
|
|||
(consult--grep prompt ripgrep-command directory query)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/project-search (&optional arg initial-query directory)
|
||||
(defun +vertico/project-search (&optional arg initial-query directory)
|
||||
"Peforms a live project search from the project root using ripgrep.
|
||||
If ARG (universal argument), include all files, even hidden or compressed ones,
|
||||
in the search."
|
||||
(interactive "P")
|
||||
(+selectrum-file-search :query initial-query :in directory :all-files arg))
|
||||
(+vertico-file-search :query initial-query :in directory :all-files arg))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/project-search-from-cwd (&optional arg initial-query)
|
||||
(defun +vertico/project-search-from-cwd (&optional arg initial-query)
|
||||
"Performs a live project search from the current directory.
|
||||
If ARG (universal argument), include all files, even hidden or compressed ones."
|
||||
(interactive "P")
|
||||
(+selectrum/project-search arg initial-query default-directory))
|
||||
(+vertico/project-search arg initial-query default-directory))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/search-symbol-at-point ()
|
||||
(defun +vertico/search-symbol-at-point ()
|
||||
(interactive)
|
||||
(consult-line (thing-at-point 'symbol)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/backward-updir ()
|
||||
(defun +vertico/backward-updir ()
|
||||
"Delete char before or go up directory for file cagetory vertico buffers."
|
||||
(interactive)
|
||||
(let ((metadata (completion-metadata (minibuffer-contents)
|
||||
|
@ -94,7 +94,7 @@ If ARG (universal argument), include all files, even hidden or compressed ones."
|
|||
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/embark-export-write ()
|
||||
(defun +vertico/embark-export-write ()
|
||||
"Export the current vertico results to a writable buffer if possible.
|
||||
|
||||
Supports exporting consult-grep to wgrep, file to wdeired, and consult-location to occur-edit"
|
||||
|
@ -112,7 +112,7 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location
|
|||
(x (user-error "embark category %S doesn't support writable export" x)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/embark-preview ()
|
||||
(defun +vertico/embark-preview ()
|
||||
"Previews candidate in vertico buffer, unless it's a consult command"
|
||||
(interactive)
|
||||
(unless (bound-and-true-p consult--preview-function)
|
||||
|
@ -121,15 +121,15 @@ Supports exporting consult-grep to wgrep, file to wdeired, and consult-location
|
|||
(embark-default-action)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/next-candidate-preview ()
|
||||
(defun +vertico/next-candidate-preview ()
|
||||
"Move to next candidate and preivew it"
|
||||
(interactive)
|
||||
(vertico-next)
|
||||
(+selectrum/embark-preview))
|
||||
(+vertico/embark-preview))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum/previous-candidate-preview ()
|
||||
(defun +vertico/previous-candidate-preview ()
|
||||
"Move to previous candidate and preview it"
|
||||
(interactive)
|
||||
(vertico-previous)
|
||||
(+selectrum/embark-preview))
|
||||
(+vertico/embark-preview))
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;;;###if (featurep! :ui workspaces)
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum--workspace-nth-source (n)
|
||||
(defun +vertico--workspace-nth-source (n)
|
||||
"Generate a consult buffer source for buffers in the NTH workspace"
|
||||
(cond ((numberp n)
|
||||
`(:name ,(nth n (+workspace-list-names))
|
||||
|
@ -22,19 +22,19 @@
|
|||
(user-error "invalid workspace source %s" n))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum--workspace-generate-sources ()
|
||||
(defun +vertico--workspace-generate-sources ()
|
||||
"Generate list of consult buffer sources for all workspaces"
|
||||
(mapcar #'+selectrum--workspace-nth-source '(0 1 2 3 4 5 6 7 8 final)))
|
||||
(mapcar #'+vertico--workspace-nth-source '(0 1 2 3 4 5 6 7 8 final)))
|
||||
|
||||
(autoload 'consult--multi "consult")
|
||||
;;;###autoload
|
||||
(defun +selectrum/switch-workspace-buffer ()
|
||||
(defun +vertico/switch-workspace-buffer ()
|
||||
"Switch to another buffer in the same workspace.
|
||||
|
||||
Use consult narrowing with another workspace number to open a buffer from that workspace
|
||||
BUG but it opens it in the current workspace (ivy also does this, but who cares)"
|
||||
(interactive)
|
||||
(when-let (buffer (consult--multi (+selectrum--workspace-generate-sources)
|
||||
(when-let (buffer (consult--multi (+vertico--workspace-generate-sources)
|
||||
:require-match
|
||||
(confirm-nonexistent-file-or-buffer)
|
||||
:prompt (format "Switch to buffer (%s): "
|
||||
|
@ -47,7 +47,7 @@ Use consult narrowing with another workspace number to open a buffer from that w
|
|||
(funcall consult--buffer-display (car buffer)))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +selectrum-embark-open-in-new-workspace (x)
|
||||
(defun +vertico-embark-open-in-new-workspace (x)
|
||||
"Open X (a file) in a new workspace."
|
||||
(+workspace/new)
|
||||
(find-file x))
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
#'completion--in-region))))
|
||||
:config
|
||||
(map! :map vertico-map
|
||||
[backspace] #'+selectrum/backward-updir))
|
||||
[backspace] #'+vertico/backward-updir))
|
||||
|
||||
(use-package! orderless
|
||||
:demand t
|
||||
:config
|
||||
(defun +selectrum-orderless-dispatch (pattern _index _total)
|
||||
(defun +vertico-orderless-dispatch (pattern _index _total)
|
||||
(cond
|
||||
;; Ensure that $ works with Consult commands, which add disambiguation suffixes
|
||||
((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$")))
|
||||
|
@ -39,7 +39,7 @@
|
|||
completion-category-defaults nil
|
||||
;; note that despite override in the name orderless can still be used in find-file etc.
|
||||
completion-category-overrides '((file (styles . (orderless partial-completion))))
|
||||
orderless-style-dispatchers '(+selectrum-orderless-dispatch)
|
||||
orderless-style-dispatchers '(+vertico-orderless-dispatch)
|
||||
orderless-component-separator "[ &]")
|
||||
;; otherwise find-file gets different highlighting than other commands
|
||||
(set-face-attribute 'completions-first-difference nil :inherit nil))
|
||||
|
@ -62,7 +62,7 @@
|
|||
[remap switch-to-buffer-other-window] #'consult-buffer-other-window
|
||||
[remap switch-to-buffer-other-frame] #'consult-buffer-other-frame
|
||||
[remap yank-pop] #'consult-yank-pop
|
||||
[remap persp-switch-to-buffer] #'+selectrum/switch-workspace-buffer)
|
||||
[remap persp-switch-to-buffer] #'+vertico/switch-workspace-buffer)
|
||||
(advice-add #'completing-read-multiple :override #'consult-completing-read-multiple)
|
||||
:config
|
||||
(recentf-mode)
|
||||
|
@ -73,7 +73,7 @@
|
|||
consult-ripgrep consult-git-grep consult-grep
|
||||
consult-bookmark consult-recent-file
|
||||
+default/search-project +default/search-project-for-symbol-at-point
|
||||
+default/search-other-project +selectrum/search-symbol-at-point
|
||||
+default/search-other-project +vertico/search-symbol-at-point
|
||||
+default/search-cwd +default/search-other-cwd
|
||||
+default/search-notes-for-symbol-at-point
|
||||
consult--source-file consult--source-project-file consult--source-bookmark
|
||||
|
@ -102,10 +102,10 @@
|
|||
"C-;" #'embark-act
|
||||
"C-c C-;" #'embark-export
|
||||
:desc "Export to writable buffer"
|
||||
"C-c C-e" #'+selectrum/embark-export-write)
|
||||
"C-c C-e" #'+vertico/embark-export-write)
|
||||
(define-key!
|
||||
[remap describe-bindings] #'embark-bindings)
|
||||
(defun +selectrum--embark-target-package! ()
|
||||
(defun +vertico--embark-target-package! ()
|
||||
"Targets Doom's package! statements and returns the package name"
|
||||
(when (or (derived-mode-p 'emacs-lisp-mode) (derived-mode-p 'org-mode))
|
||||
(save-excursion
|
||||
|
@ -123,12 +123,12 @@
|
|||
(length embark-target-finders))))
|
||||
(cl-callf2
|
||||
cons
|
||||
'+selectrum--embark-target-package!
|
||||
'+vertico--embark-target-package!
|
||||
(nthcdr pos embark-target-finders)))
|
||||
(map!
|
||||
:map embark-file-map
|
||||
:desc "Open target with sudo" "s" #'doom/sudo-find-file
|
||||
:desc "Open in new workspace" "TAB" #'+selectrum-embark-open-in-new-workspace)
|
||||
:desc "Open in new workspace" "TAB" #'+vertico-embark-open-in-new-workspace)
|
||||
(setq embark-package-map (make-sparse-keymap))
|
||||
(map! :map embark-package-map
|
||||
"h" #'doom/help-packages
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue