How to search among all files in, or below, a directoryI have for a long time had the problem, that…
انتشار: 2026/07/08 12:07 UTC
How to search among all files in, or below, a directoryI have for a long time had the problem, that I could not easily find and open certain files. For example, the Doom emacs user files in ~/.config/emacs/.local.Almost all emacs file searching commands do by default ignore those files. An exception is find-name-dired.The files are ignored either because:- The search command ignores a file or directory with name starting with . (period).- The search command ignores files and directories matching patterns in files such as .gitignore.The search commands usually do the actual search by calling a command line command, such as find, fd or rg. There is usually a way to configure the filtering done by the emacs search command. One can thus either change the default behavior of the command, or create alternative search commands.The command line command fd, is the easiest to control. The fd (or fdfind) manual list two relevant command line options: -H or --hidden, and -I or --no-ignore:- --hidden tells fd to search also directories and files with name starting with .. However, the directories and files may still be filtered by the ignore mechanism (option --no-ignore).- --no-ignore tells fd to turn off filtering done by files such as .gitignore.The command line command rg also has the above command line options.For the emacs search command consult-find-fd one can modify variable consult-fd-args, by adding:~~~"--no-ignore --hidden"~~~Example:~~~(setq consult-fd-args'((if (executable-find "fdfind" 'remote) "fdfind" "fd") "--color=never""--full-path --absolute-path" "--no-ignore --hidden --exclude .git"(if (featurep :system 'windows) "--path-separator=/")))~~~For the emacs search command consult-find one can modify variable consult-find-args, to not ignore hidden files.Example:~~~(setq consult-find-args"find .")~~~The melpa package fzfa has lots of search commands, based on the fuzzy finder fzf:github.com/junegunn/fzfFor the emacs search command fzfa-fd one can modify variable fzfa-fd-command, to not ignore hidden files.Example:~~~(setq fzfa-fd-command "fd --no-ignore --hidden")~~~fzfa has a dependency on ivy, so ivy must be enabled, if one wants to install fzfa:~~~(use-package ivy)~~~redd.it/1uqppwi@r_emacs