Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
The exact command for
helm-locate can be customized through the variable
helm-locate-command. The default value works on most
locate versions and variants.
On more recent versions of
locate, you may want to use multi-matching with the
--regex option, which is not available in older versions:
(setq helm-locate-command "locate %s -e -A --regex %s")
Update: On helm version >=2.4.0 this is now the default.
helm-locate command, then enter a filename or pattern at the prompt. Some options are below:
|-b||Only use the base name (no directories)|
|-e||Only include files that actually exist|
|-n||Limit number of search results|
emacs -b -e -n 12
Note that adding options at end of pattern is disabling fuzzy
You should add the
-b option at end of other options to let helm
highlight properly the right part (i.e basename) of candidate.
C-x C-f. With a prefix argument, you can choose a
With two prefix args the database file will be recreated.
When the search is done, you can search in a specific file or directory with the
grep action in the action menu (TAB). You can also launch Helm
(C-u) M-g s without switching to the action panel.
You can specify a
locate database with prefix argument ARG (
C-u). Many databases can be used: navigate to and mark them. See
To create a user specific db, use:
updatedb -l 0 -o dbpath -U directory
dbpath is a filename matched by
Search in a list of projects only
For this, populate the list
helm-locate-project-list with a list of
projects, then run M-x
search for files only in the database of these projects.
Enable fuzzy matching in locate
The only thing you have to do is:
(setq helm-locate-fuzzy-match t)
Once this is enabled,
helm-locate will search on the basename of
files, adding automatically the
-b flag, so you don’t need to add
it. As soon as you add spaces between your patterns multi matching
will happen instead of fuzzy, with regexp matching on each pattern
(no fuzzy matching of separate pattern), also when switching to multi
matching, search is done on the whole path and no more on basename.
When fuzzy matching, candidates are sorted with
helm-locate-fuzzy-sort-fn which use by default the helm fuzzy
matching default sort fn
helm-locate-default-fuzzy-sort-fn, you can
customize this if needed.
On Windows, you should use Everything, which works like
is very fast and does not require manual database updates.
helm-locate, you will need the command line
es. Be sure to modify the
PATH environment variable to
include path to the directory that contain
es. Also unset
Everything will give no results.
es on Windows, you may want to use the sorting feature
(put the recentest visited files on top) provided by its very last
version (>=es 22.214.171.124a), for this you will have to add here the required arguments to
-sort run-count and also notify the Everything database
you jumped to some file by running
es -inc-run-count file each
time you visit a file, to achieve this you can add a function doing this to
(setq helm-locate-command "es %s -sort run-count %s") (defun helm-es-hook () (when (and (equal (assoc-default 'name (helm-get-current-source)) "Locate") (string-match "\\`es" helm-locate-command)) (mapc (lambda (file) (call-process "es" nil nil nil "-inc-run-count" (convert-standard-filename file))) (helm-marked-candidates)))) (add-hook 'helm-find-many-files-after-hook 'helm-es-hook)
helm-locate-fuzzy-match. If it is set to
mdfind is used,
helm-locate won’t show any results.