Skip to content

counsel-fzf feedback #1263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
agsdot opened this issue Oct 31, 2017 · 10 comments
Closed

counsel-fzf feedback #1263

agsdot opened this issue Oct 31, 2017 · 10 comments

Comments

@agsdot
Copy link

agsdot commented Oct 31, 2017

@jojojames and @abo-abo,

Thanks for incorporating fzf into counsel. It's nice to have the same/consistent UI with other counsel functions in using fzf. I was really glad to see PR #1151 recently go through.

After using counsel-fzf for a day or two, I couldn't help notice that it behaved slightly different than counsel-recentf.

The latter progressively displays the letters that one is typing, where for counsel-fzf the letters being typed are not highlighted?

Below are two screenshots to highlight the difference.

recentf

counsel-fzf

counsel-recentf highlights "ihb" of other possible selections, whereas for counsel-fzf it doesn't highlight the "sgpgmelp" I typed in.

How can this consistency be ironed out so that counsel-fzf behaves and looks like other counsel functions like counsel-recentf?

Thanks!

@agsdot
Copy link
Author

agsdot commented Oct 31, 2017

I realized "sgpgmelp" was a very narrow a item to search, searching for "sgpgmd" is a broader search.

Attached is a second screenshot of that broader search -- and still the same UI experience, no highlighting of characters that matched.

counsel-fzf-2

The visual cues of what letters were typed in as in counsel-recentf is very helpful, and it would be awesome if it too were shown in counsel-fzf.

@jojojames
Copy link
Contributor

Hmnn, I don't think it's possible. counsel-recentf probably matches and highlights the matches using flx or something. fzf under the hood is just using fzf -f to get a list back.

@agsdot
Copy link
Author

agsdot commented Oct 31, 2017

Is it using flx?

https://github.com/abo-abo/swiper/blob/master/counsel.el#L1783
;;** `counsel-recentf'
(defvar recentf-list)
(declare-function recentf-mode "recentf")

;;;###autoload
(defun counsel-recentf ()
"Find a file on `recentf-list'."
(interactive)
(require 'recentf)
(recentf-mode)
(ivy-read "Recentf: " (mapcar #'substring-no-properties recentf-list)
:action (lambda (f)
(with-ivy-window
(find-file f)))
:caller 'counsel-recentf))
(ivy-set-actions
'counsel-recentf
'(("j" find-file-other-window "other window")
("x" counsel-find-file-extern "open externally")))

I'm still wondering how the progressive pattern matching is done for counsel-recentf and not being done for counsel-fzf. Thanks @jojojames .

@abo-abo
Copy link
Owner

abo-abo commented Oct 31, 2017

@agsdot @jojojames Thanks, please test.

@jojojames
Copy link
Contributor

@agsdot I'm pretty sure counsel-recentf is just using the pattern matching through its own matcher.

Fzf has its own pattern matching so you won't be able to get highlighting out of it.

@agsdot
Copy link
Author

agsdot commented Oct 31, 2017

Much better. Thanks @abo-abo.

counsel-fzf-highlight

@jojojames
Copy link
Contributor

@agsdot Glad it's working for you. I do wonder how accurate the highlighting will be since it's using separate algorithms to get the list of matches/highlight.

Probably better than nothing/works in the 98% case.

Thanks @abo-abo.

@agsdot
Copy link
Author

agsdot commented Nov 1, 2017

@jojojames. So far so good. Haven't used/tested it too much though.

The most important thing is/was the accuracy of the fzf results. Secondary is the highlight -- it's just a nice convenience.

Thanks @abo-abo and @jojojames for working on this.

@ghost
Copy link

ghost commented Apr 10, 2018

Can we see only the git files some way? I did ask this in #1525. I think it is a matter of changing in the input command. Anyone knows if this is configurable or a way to change that?

@jojojames
Copy link
Contributor

@varmanishant You can use setenv.

(setenv "FZF_DEFAULT_COMMAND"
(string-trim (shell-command-to-string ". ~/.zshrc; echo -n $FZF_DEFAULT_COMMAND")))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants