completion/ivy: fix +fuzzy

This commit is contained in:
Henrik Lissner 2019-12-16 17:46:47 -05:00
parent 3cefe161fa
commit cdfef48b64
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -18,13 +18,16 @@ results buffer.")
(if (featurep! +prescient) (if (featurep! +prescient)
#'+ivy-prescient-non-fuzzy #'+ivy-prescient-non-fuzzy
#'ivy--regex-plus) #'ivy--regex-plus)
"Function to use for non-fuzzy search commands.") "Function to use for non-fuzzy search commands.
This uses the standard search algorithm ivy uses (or a variant of it).")
(defvar +ivy-alternative-search-fn (defvar +ivy-alternative-search-fn
(cond ((featurep! +prescient) #'ivy-prescient-re-builder) (cond ((featurep! +prescient) #'ivy-prescient-re-builder)
((featurep! +fuzzy) #'ivy--regex-fuzzy) ((featurep! +fuzzy) #'ivy--regex-fuzzy)
;; Ignore order for non-fuzzy searches by default
(#'ivy--regex-ignore-order)) (#'ivy--regex-ignore-order))
"Function to use for fuzzy search commands.") "Function to use for fuzzy search commands.
This uses a search algorithm other than ivy's default.")
;; ;;
@ -34,12 +37,10 @@ results buffer.")
:after-call pre-command-hook :after-call pre-command-hook
:init :init
(setq ivy-re-builders-alist (setq ivy-re-builders-alist
`(,@(cl-loop for cmd in '(counsel-rg `((counsel-rg . +ivy-standard-search)
swiper (swiper . +ivy-standard-search)
swiper-isearch) (swiper-isearch . +ivy-standard-search)
collect (cons cmd #'+ivy-alternative-search)) (t . +ivy-alternative-search)))
;; Ignore order for non-fuzzy searches by default
(t . +ivy-standard-search)))
(define-key! (define-key!
[remap switch-to-buffer] #'+ivy/switch-buffer [remap switch-to-buffer] #'+ivy/switch-buffer