-
-
Notifications
You must be signed in to change notification settings - Fork 390
Locate
helm-locate
(<helm-prefix> l
by default) is Helm’s interface to the locate command, which finds files on your system that have been indexed with updatedb.
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")
Execute the helm-locate
command, then enter a filename or pattern at the prompt. Some options are below:
Option | Description |
---|---|
-b | Only use the base name (no directories) |
-e | Only include files that actually exist |
-n | Limit number of search results |
Example pattern:
emacs -b -e -n 12
In helm-find-files
, hit C-x C-f
. With a prefix argument, you can choose a locatedb
file.
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 grep
with (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 helm-locate-with-db
.
To create a user specific db, use:
updatedb -l 0 -o dbpath -U directory
where dbpath
is a filename matched by helm-locate-db-file-regexp
.
On Windows, you should use Everything, which works like locate
. It
is very fast and does not require manual database updates.
To use Everything
with helm-locate
, you will need the command line
tool named es
. Be sure to modify the PATH
environment variable to
include path to the directory that contain es
. Also unset
helm-locate-fuzzy-match
, or Everything
will give no results.
When using 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 1.1.0.4a), for this you will have to add here the required arguments to
es
i.e -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
helm-find-many-files-after-hook
.
e.g
(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)
See Topic and issue #1645 on github for more infos.
To use mdfind
, disable helm-locate-fuzzy-match
. If it is set to t
and mdfind
is used, helm-locate
won’t show any results.