After many years of living in vanilla Emacs, I am playing with souping things up a bit, and trying out ivy/counsel.

I'm finding the experience of counsel-find-file a bit jarring, because it does not tab me where my years of muscle memory expect to tab, or really where I think is preferable.

For example, I have directories

~/development/contrib-git/ # projects not mine I contribute to
~/development/gitproj/     # projects mostly mine

When I type ~/development/git<tab>, I'd expect it to tab into gitproj, but in fact, the regex-based completion list shows contrib-git first, so often I find myself unwantedly there.

I've tried modifying ivy-initial-inputs-alist to place a ^ prefix automatically into counsel-find-files, but this doesn't help, it only places that at the beginning of the full path, not at the beginning of each element. I can manually type ^ at the beginning of each element, but that's not so fluid.

And I don't at all mind the much richer completion list! I just want, for each path segment, the first item in the completion ordering, the one I'll tab into if I don't navigate downwards, to be the one containing the prefix I have actually typed.

Is there any way to configure this?

Many thanks!

1 Answer 1


The following combination of modifications seems to have given me just what I want: tab completion according to prefix (as my muscle memory expects from shelling and vanilla emacs), while keeping a rich menu of completions I can navigate to in the minibuffer if I choose to.

The ordering I want came from

(straight-use-package 'prescient)
(straight-use-package 'ivy-prescient)
(require 'prescient)
(require 'ivy-prescient)
(setq prescient-filter-method '(literal-prefix literal regexp initialism fuzzy)) ;; cribbed and combined from various examples

The ability to <tab>-<tab>-<tab> harmlessly without entering into a file or dired buffer unintentionally came from

(define-key ivy-minibuffer-map (kbd "TAB") 'ivy-partial) ;; don't open anything until I hit return please!

I'll need a few days to live with this setup and see how it goes, but it looks like this gives me what I want — the rich ivy completion menus, but tab behavior that won't require me to overcome years of muscle memory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.