Created
May 26, 2021 21:12
-
-
Save djuber/a3071cd7ed5f0ad322e079358f5904aa to your computer and use it in GitHub Desktop.
make ivy (counsel-M-x) expansion respect ido style dashed abbreviations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Thanks @bschmeck | |
(defun shmk/ivy--regex-dashes (str) | |
"Build a regex sequence from STR. | |
Insert .* before each -." | |
(let ((subs (split-string str "-"))) | |
(if (= (length subs) 1) | |
(ivy--regex str) | |
(ivy--regex (concat "^" (string-join subs "[[:alnum:]]*-")))))) | |
(setq ivy-re-builders-alist | |
'((execute-extended-command . shmk/ivy--regex-dashes) | |
(t . ivy--regex-plus))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment