11

When I use helm-find-files to search for a directory. I would like it to display exact matches and directories first in the list of candidates, followed by files.

For example, searching for "src" gives the following results:

helm-example

How can I make "src" show up first, since it's an exact match and also a directory? Or, baring that, making hidden "." files go to the end of the list (since it seems to be in alphabetical order?)

Lee H
  • 2,697
  • 1
  • 16
  • 31
  • 1
    `^src$` should match only `src`. – abo-abo Dec 31 '14 at 14:34
  • 1
    @abo-abo yeah, I know I could add regexp for it, but I'd like to change the default sort order when it's not specified – Lee H Dec 31 '14 at 14:38
  • 1
    Are you aware of the new flex matching, and do you want to turn it off? If you want this sort behavior with flex matching enabled (which it is by default), then I think the helm devs are working on it, but it's not ready yet. – PythonNut Jan 02 '15 at 05:04
  • @PythonNut I'd prefer to keep the flex matching on, so hopefully the helm devs will get it fixed soon! – Lee H Jan 02 '15 at 11:18
  • @PythonNut Unrelated, but I'd like to know how to turn the flex matching off. Preferrably in every helm command, but mostly in helm-find-files, helm-mini, and helm-recentf. – nanny Jan 02 '15 at 14:09
  • 1
    @LeeH [the github issue](https://github.com/emacs-helm/helm/issues/145) is the source for all information helm-fuzzy related at the moment. – PythonNut Jan 02 '15 at 15:58
  • 1
    @nanny I think fuzzy matching is off by default for all commands, except `helm-find-files`. See [Fuzzy Matching](https://github.com/emacs-helm/helm#fuzzy-matching) section for a list of commands that have fuzzy matching (which is disabled by default). Or are you using `helm-projectile`? I am planning to add an option to disable fuzzy-matching. – Tu Do Jan 04 '15 at 14:04
  • 2
    @LeeH You should update to the latest Helm. It is fixed now. A new custom variable is added: `helm-find-files-sort-directories`. To enable your desired behavior, set it to `t`. – Tu Do Jan 04 '15 at 14:13
  • For some reason the change was hard to spot, but indeed it is there, in [this commit](https://github.com/emacs-helm/helm/commit/063cef69aa5d88f20d15c7dc272579a9f6d5ce8f). However, the variable is not there in the [current version of the file as of today](https://github.com/emacs-helm/helm/blob/master/helm-files.el). – Joe Corneli May 27 '15 at 19:38

1 Answers1

2

According to the comments from @Tu Do above, apparently that was possible at one time, but the feature has been taken out in commit 8489bee and related commits.

Joe Corneli
  • 1,786
  • 1
  • 14
  • 27
  • 1
    BTW, the interested reader might find my answer at http://emacs.stackexchange.com/questions/12745/how-to-sort-file-list-in-helm-find-files-by-date can be reused in this context, if you're willing to modify `helm-files.el` locally. – Joe Corneli May 27 '15 at 20:29