I have

          (setq ivy-sort-matches-functions-alist
                '((t . ivy--prefix-sort)))

If I am in a directory with files mc_multiword.txt and multiword.txt and am using counsel-find-file, I start typing m. The files are sorted alphabetically, with mc_multiword both first in the list (it's alphabetically earliest) and selected (with a highlighting face).

I then type u. It resorts so that multiword.txt is first (I believe this is thanks to the ivy--prefix-sort), but mc_multiword.txt remains selected. This means that when I hit TAB or RETURN I get the longer (and usually unintended) mc_multiword.txt file opened rather than the file with the name that is shorter and has my typed characters as a prefix of its name.

I realise that I can change the selection manually and get the desired file to open, but it's annoying to have what vanilla find-file would get me precluded.

Is there a configuration option that would give me the behavior I want?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.