How to find a file in Emacs without a known exact directory?

It is very easy to find a file in vim without knowing in which directory the file is located. By executing this ": args ** / file.hpp", if the file exists, it will open it.

Is there any replacement in Emacs for this? The search file seems to work with wildcards, but it's not as complicated as vim with ** .

+6
emacs
source share
6 answers

Mx find-name-dired looks the way you want (you will be asked to enter the root directory to start the search and the file mask)

+15
source share

A dumber but still handy tool: Mx locate

Using OS X? This allows emacs to use a spotlight instead of the standard locate :

 (setq locate-command "mdfind") 
+4
source share

Good tip if you use ido-find-file :
From a well-known root directory, you can use ido-wide-find-file-or-pop-dir , which by default is bound to Mf .

+4
source share

FindFileInProject is also worth a look.

+2
source share

In Icicles, you can find files by matching not only the relative file name, but any parts of the path. You can use substring, regex and fuzzy matching. You can And together several search patterns (progressive completion). See the multi-command icicle-locate-file command. And you can even search for the contents of the file as well or instead of the file name.

http://www.emacswiki.org/emacs/Icicles_-_File-Name_Input

+1
source share

I like

 Mx ifind /some/path/to/start/file.hpp 

or simply

 Mx ifind file.hpp 

using the ifind package found here . Note: it opens the *ifind* buffer, which displays the results that you can select with the mouse, or use with Cx ` (aka Mx next-error ).

0
source share

All Articles