Helm is an extremely powerful package that provides a search interface that narrows the matches as you type. What makes it powerful is the range of back-ends that you can access through helm. I don’t use it for a lot of things (I slightly prefer ivy in general), but one of my favourites is helm-for-files
. This gives you a search interface where you start typing the name of a file and it narrows a list of files from multiple useful sources: currently opened files; recent files; bookmarked files; files in the current directory; and files anywhere on your system using your system’s locate
command. Basically, it find any file anywhere on your system, showing you the most likely matches first. Hitting RET
to select a file opens it in Emacs as usual.
Here is how I install and configure helm for this purpose
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; helm ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (use-package helm :ensure t :init (progn (require 'helm-config) ;; limit max number of matches displayed for speed (setq helm-candidate-number-limit 100) ;; ignore boring files like .o and .a (setq helm-ff-skip-boring-files t) ;; replace locate with spotlight on Mac (setq helm-locate-command "mdfind -name %s %s")) :bind (("C-x f" . helm-for-files)))
Since I use a Mac, I tell helm to use mdfind
which is the command line interface to the spotlight
indexer in place of the normal locate
command. Finally, I bind the command to C-x f
to serve as a memorable alternative for C-x C-f
(the default interface for opening files).