completion/vertico: reformatting
This commit is contained in:
parent
cfcf7e0d03
commit
b92caaa3c2
1 changed files with 49 additions and 43 deletions
|
@ -4,35 +4,39 @@
|
||||||
"Completion styles for company to use.
|
"Completion styles for company to use.
|
||||||
|
|
||||||
The completion/vertico module uses the orderless completion style by default,
|
The completion/vertico module uses the orderless completion style by default,
|
||||||
but this returns too broad a candidate set for company completion. This
|
but this returns too broad a candidate set for company completion. This variable
|
||||||
variable overrides `completion-styles' during company completion sessions.")
|
overrides `completion-styles' during company completion sessions.")
|
||||||
|
|
||||||
|
|
||||||
|
;;
|
||||||
|
;;; Packages
|
||||||
|
|
||||||
(use-package! vertico
|
(use-package! vertico
|
||||||
:hook (doom-first-input . vertico-mode)
|
:hook (doom-first-input . vertico-mode)
|
||||||
:config
|
:config
|
||||||
(setq vertico-resize nil
|
(setq vertico-resize nil
|
||||||
vertico-count 17
|
vertico-count 17
|
||||||
vertico-cycle t)
|
vertico-cycle t
|
||||||
(setq completion-in-region-function
|
completion-in-region-function
|
||||||
(lambda (&rest args)
|
(lambda (&rest args)
|
||||||
(apply (if vertico-mode
|
(apply (if vertico-mode
|
||||||
#'consult-completion-in-region
|
#'consult-completion-in-region
|
||||||
#'completion--in-region)
|
#'completion--in-region)
|
||||||
args)))
|
args)))
|
||||||
;; cleans up path when moving directories with shadowed paths syntax,
|
;; Cleans up path when moving directories with shadowed paths syntax, e.g.
|
||||||
;; e.g. cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/.
|
;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/.
|
||||||
(add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)
|
(add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)
|
||||||
(map! :map vertico-map
|
(map! :map vertico-map [backspace] #'+vertico/backward-updir))
|
||||||
[backspace] #'+vertico/backward-updir))
|
|
||||||
|
|
||||||
(use-package! orderless
|
(use-package! orderless
|
||||||
:defer t
|
|
||||||
:after-call doom-first-input-hook
|
:after-call doom-first-input-hook
|
||||||
:config
|
:config
|
||||||
(defun +vertico-orderless-dispatch (pattern _index _total)
|
(defun +vertico-orderless-dispatch (pattern _index _total)
|
||||||
(cond
|
(cond
|
||||||
;; Ensure that $ works with Consult commands, which add disambiguation suffixes
|
;; Ensure that $ works with Consult commands, which add disambiguation suffixes
|
||||||
((string-suffix-p "$" pattern) `(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$")))
|
((string-suffix-p "$" pattern)
|
||||||
|
`(orderless-regexp . ,(concat (substring pattern 0 -1) "[\x100000-\x10FFFD]*$")))
|
||||||
;; Ignore single !
|
;; Ignore single !
|
||||||
((string= "!" pattern) `(orderless-literal . ""))
|
((string= "!" pattern) `(orderless-literal . ""))
|
||||||
;; Without literal
|
;; Without literal
|
||||||
|
@ -55,10 +59,10 @@ variable overrides `completion-styles' during company completion sessions.")
|
||||||
;; otherwise find-file gets different highlighting than other commands
|
;; otherwise find-file gets different highlighting than other commands
|
||||||
(set-face-attribute 'completions-first-difference nil :inherit nil))
|
(set-face-attribute 'completions-first-difference nil :inherit nil))
|
||||||
|
|
||||||
|
|
||||||
(use-package! consult
|
(use-package! consult
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init
|
||||||
(advice-add #'multi-occur :override #'consult-multi-occur)
|
|
||||||
(define-key!
|
(define-key!
|
||||||
[remap apropos] #'consult-apropos
|
[remap apropos] #'consult-apropos
|
||||||
[remap bookmark-jump] #'consult-bookmark
|
[remap bookmark-jump] #'consult-bookmark
|
||||||
|
@ -75,6 +79,7 @@ variable overrides `completion-styles' during company completion sessions.")
|
||||||
[remap yank-pop] #'consult-yank-pop
|
[remap yank-pop] #'consult-yank-pop
|
||||||
[remap persp-switch-to-buffer] #'+vertico/switch-workspace-buffer)
|
[remap persp-switch-to-buffer] #'+vertico/switch-workspace-buffer)
|
||||||
(advice-add #'completing-read-multiple :override #'consult-completing-read-multiple)
|
(advice-add #'completing-read-multiple :override #'consult-completing-read-multiple)
|
||||||
|
(advice-add #'multi-occur :override #'consult-multi-occur)
|
||||||
:config
|
:config
|
||||||
(recentf-mode)
|
(recentf-mode)
|
||||||
(setq consult-project-root-function #'doom-project-root
|
(setq consult-project-root-function #'doom-project-root
|
||||||
|
@ -104,23 +109,23 @@ variable overrides `completion-styles' during company completion sessions.")
|
||||||
:items ,(lambda () (mapcar #'buffer-name (org-buffer-list)))))
|
:items ,(lambda () (mapcar #'buffer-name (org-buffer-list)))))
|
||||||
(add-to-list 'consult-buffer-sources '+vertico--consult-org-source 'append)))
|
(add-to-list 'consult-buffer-sources '+vertico--consult-org-source 'append)))
|
||||||
|
|
||||||
|
|
||||||
(use-package! consult-flycheck
|
(use-package! consult-flycheck
|
||||||
:when (featurep! :checkers syntax)
|
:when (featurep! :checkers syntax)
|
||||||
:after (consult flycheck))
|
:after (consult flycheck))
|
||||||
|
|
||||||
|
|
||||||
(use-package! embark
|
(use-package! embark
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init
|
||||||
(map! "C-;" #'embark-act ; to be moved to :config default if accepted
|
(map! [remap describe-bindings] #'embark-bindings
|
||||||
:map minibuffer-local-map
|
"C-;" #'embark-act ; to be moved to :config default if accepted
|
||||||
|
(:map minibuffer-local-map
|
||||||
"C-;" #'embark-act
|
"C-;" #'embark-act
|
||||||
"C-c C-;" #'embark-export
|
"C-c C-;" #'embark-export
|
||||||
:desc "Export to writable buffer"
|
:desc "Export to writable buffer" "C-c C-e" #'+vertico/embark-export-write)
|
||||||
"C-c C-e" #'+vertico/embark-export-write
|
(:leader
|
||||||
:leader
|
:desc "Actions" "a" #'embark-act)) ; to be moved to :config default if accepted
|
||||||
:desc "Actions" "a" #'embark-act) ; to be moved to :config default if accepted
|
|
||||||
(define-key!
|
|
||||||
[remap describe-bindings] #'embark-bindings)
|
|
||||||
:config
|
:config
|
||||||
(set-popup-rule! "^\\*Embark Export Grep" :size 0.35 :ttl 0 :quit nil)
|
(set-popup-rule! "^\\*Embark Export Grep" :size 0.35 :ttl 0 :quit nil)
|
||||||
|
|
||||||
|
@ -140,36 +145,37 @@ variable overrides `completion-styles' during company completion sessions.")
|
||||||
'+vertico--embark-target-package
|
'+vertico--embark-target-package
|
||||||
(nthcdr pos embark-target-finders)))
|
(nthcdr pos embark-target-finders)))
|
||||||
(setq embark-package-map (make-sparse-keymap))
|
(setq embark-package-map (make-sparse-keymap))
|
||||||
(map!
|
(map! (:map embark-file-map
|
||||||
:map embark-file-map
|
|
||||||
:desc "Open target with sudo" "s" #'doom/sudo-find-file
|
:desc "Open target with sudo" "s" #'doom/sudo-find-file
|
||||||
:desc "Open in new workspace" "TAB" #'+vertico-embark-open-in-new-workspace
|
:desc "Open in new workspace" "TAB" #'+vertico-embark-open-in-new-workspace)
|
||||||
:map embark-package-map
|
(:map embark-package-map
|
||||||
"h" #'doom/help-packages
|
"h" #'doom/help-packages
|
||||||
"b" #'doom/bump-package
|
"b" #'doom/bump-package
|
||||||
"c" #'doom/help-package-config
|
"c" #'doom/help-package-config
|
||||||
"u" #'doom/help-package-homepage))
|
"u" #'doom/help-package-homepage)))
|
||||||
|
|
||||||
|
|
||||||
(use-package! marginalia
|
(use-package! marginalia
|
||||||
:hook (doom-first-input . marginalia-mode)
|
:hook (doom-first-input . marginalia-mode)
|
||||||
:init
|
:init
|
||||||
(map! :map minibuffer-local-map
|
(map! :map minibuffer-local-map
|
||||||
:desc "Cycle marginalia views"
|
:desc "Cycle marginalia views" "M-A" #'marginalia-cycle)
|
||||||
"M-A" #'marginalia-cycle)
|
|
||||||
:config
|
:config
|
||||||
(when (featurep! +icons)
|
(when (featurep! +icons)
|
||||||
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup))
|
(add-hook 'marginalia-mode-hook #'all-the-icons-completion-marginalia-setup))
|
||||||
(nconc marginalia-command-categories
|
(pushnew! marginalia-command-categories
|
||||||
'((persp-switch-to-buffer . buffer)
|
'(persp-switch-to-buffer . buffer)
|
||||||
(projectile-find-file . project-file)
|
'(projectile-find-file . project-file)
|
||||||
(doom/describe-active-minor-mode . minor-mode)
|
'(doom/describe-active-minor-mode . minor-mode)
|
||||||
(flycheck-error-list-set-filter . builtin))))
|
'(flycheck-error-list-set-filter . builtin)))
|
||||||
|
|
||||||
|
|
||||||
(use-package! embark-consult
|
(use-package! embark-consult
|
||||||
:after (embark consult)
|
:after (embark consult)
|
||||||
:config
|
:config
|
||||||
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
|
(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode))
|
||||||
|
|
||||||
|
|
||||||
(use-package! wgrep
|
(use-package! wgrep
|
||||||
:commands wgrep-change-to-wgrep-mode
|
:commands wgrep-change-to-wgrep-mode
|
||||||
:config (setq wgrep-auto-save-buffer t))
|
:config (setq wgrep-auto-save-buffer t))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue