branch: master
commit 96663b77945ab21e4e1b0aab690fc2e926f01f9c
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>
counsel.el (counsel-fzf-function): Enable highlighting
Fixes #1263
Two pieces important for highlighting here:
- Setting `ivy--old-re' sets up highlighting
- To set up the correct highlight function (fuzzy one, see
`ivy-highlight-functions-alist'), I set :re-builder.
---
counsel.el | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/counsel.el b/counsel.el
index 2a87113..296458e 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1913,8 +1913,9 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
(format counsel-fzf-cmd
(if (string-equal str "")
"\"\""
- (counsel-unquote-regex-parens
- (ivy--regex str))))))
+ (progn
+ (setq ivy--old-re (ivy--regex-fuzzy str))
+ str)))))
nil)
;;;###autoload
@@ -1923,14 +1924,16 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
INITIAL-INPUT can be given as the initial minibuffer input."
(interactive)
(counsel-require-program (car (split-string counsel-fzf-cmd)))
- (setq counsel--fzf-dir (if (and
- (fboundp 'projectile-project-p)
- (fboundp 'projectile-project-root)
- (projectile-project-p))
- (projectile-project-root)
- default-directory))
+ (setq counsel--fzf-dir
+ (if (and
+ (fboundp 'projectile-project-p)
+ (fboundp 'projectile-project-root)
+ (projectile-project-p))
+ (projectile-project-root)
+ default-directory))
(ivy-read "> " #'counsel-fzf-function
:initial-input initial-input
+ :re-builder #'ivy--regex-fuzzy
:dynamic-collection t
:action #'counsel-fzf-action
:unwind #'counsel-delete-process