feat(vertico): use basic completion for remotes

Close: #5313

Co-authored-by: Stefan Lendl <ste.lendl@gmail.com>
This commit is contained in:
Itai Y. Efrat 2021-08-13 00:26:10 +03:00
parent 2fdcefa831
commit fc163b16c9
2 changed files with 17 additions and 1 deletions

View file

@ -299,3 +299,13 @@ targets."
(if keymap (if keymap
(cons '(vertico-current . embark-target) fr) (cons '(vertico-current . embark-target) fr)
fr)))))) fr))))))
;;;###autoload
(defun +vertico-basic-remote-try-completion (string table pred point)
(and (vertico--remote-p string)
(completion-basic-try-completion string table pred point)))
;;;###autoload
(defun +vertico-basic-remote-all-completions (string table pred point)
(and (vertico--remote-p string)
(completion-basic-all-completions string table pred point)))

View file

@ -53,11 +53,17 @@ overrides `completion-styles' during company completion sessions.")
;; Flex matching ;; Flex matching
((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1))) ((string-prefix-p "~" pattern) `(orderless-flex . ,(substring pattern 1)))
((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1))))) ((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1)))))
(add-to-list
'completion-styles-alist
'(+vertico-basic-remote
+vertico-basic-remote-try-completion
+vertico-basic-remote-all-completions
"Use basic completion on remote files only"))
(setq completion-styles '(orderless) (setq completion-styles '(orderless)
completion-category-defaults nil completion-category-defaults nil
;; note that despite override in the name orderless can still be used in ;; note that despite override in the name orderless can still be used in
;; find-file etc. ;; find-file etc.
completion-category-overrides '((file (styles . (orderless partial-completion)))) completion-category-overrides '((file (styles +vertico-basic-remote orderless partial-completion)))
orderless-style-dispatchers '(+vertico-orderless-dispatch) orderless-style-dispatchers '(+vertico-orderless-dispatch)
orderless-component-separator "[ &]") orderless-component-separator "[ &]")
;; ...otherwise find-file gets different highlighting than other commands ;; ...otherwise find-file gets different highlighting than other commands