How to find a file recursively, fuzzily, with vertico reddit / emacs ---------------------------------------------------------------------- stevebarratt · 2022-02-04 13:14 I'm using Doom emacs set up with vertico for completion.. I would like to find a file to open, but... * it is in my home directory somewhere, but I don't know where * I have only a vague recollection of its name and the name of the directory in which it resides. If I were in my terminal emulator, I would navigate to `~`, then `emacs` (or similar) then do a ~fzf~ search for the filename, while mashing in some of the directory name which I can remember. I'd then select the file from the list of suspects. What is the best way to get something like this happening with my vertico setup? I like the way the `~` suffix works, I would just like it to go recursive, basically. I can't use helm or ivy, as a package I have to use is incompatible. Hopefully this is super simple and I'm just missing something obvious. ---------------------------------------------------------------------- linwaytin · 2022-02-04 13:48 I use `affe-find` to do this. Bind `(affe-find "~/")` to some key you like, then you can search the file including its path. ---------------------------------------------------------------------- pwnedary · 2022-02-04 14:13 I have this function (let ((find-files-program (cond ((executable-find "rg") '("rg" "-- color=never" "--files")) ((executable-find "find") '("find" "-type" "f"))))) (defun find-file-rec () "Find a file in the current working directory recursively." (interactive) (find-file (completing-read "Find file: " (apply #'process-lines find-files- program))))) (advice-add #'find-file-rec :around #'with-project-dir) for that purpose. Together with Selectrum and the Hotfuzz dynamic module I can fuzzy match on all 60000 files in my home directory with ease (once ripgrep finishes of course). ---------------------------------------------------------------------- easter_islander · 2022-02-04 16:19 `consult-find` ---------------------------------------------------------------------- easter_islander · 2022-02-04 16:21 The question seemed to be just finding files by name, for which `consult-find` works. Doesn't `consult-ripgrep` do what your function does? ---------------------------------------------------------------------- ExistingProgram3883 · 2022-02-04 17:12 How does this compare to `counsel-fzf` ---------------------------------------------------------------------- stevebarratt · 2022-02-04 17:53 Thanks for the ideas. I really like `affe`, u/linwaytin, thanks! For the record, using Doom, adding `(package! affe)` to `packages.el`, and ​ ``` (map! :leader :desc "FuZzily find File in home" "f z f" (cmd!! #'affe-find "~/")) (map! :leader :desc "FuZzily find file in this Dir" "f z d" (cmd!! #'affe-find)) ``` to `config.el` got me right where I wanted to get to. I added entries in the 'files' menu to access the functions (though I couldn't work out quite how to make a proper sub sub menu? anyone?) ---------------------------------------------------------------------- linwaytin · 2022-02-04 17:53 I think affe is better. It is faster on my system. ---------------------------------------------------------------------- wargxs · 2022-02-04 18:39 Does affe work via tramp? ---------------------------------------------------------------------- wargxs · 2022-02-04 18:42 consult-locate ? ---------------------------------------------------------------------- pwnedary · 2022-02-04 19:39 Yes, consult has something similar that is also async. So if OP already is using consult then that would be a good option. However consult is >4500 lines compared to the <10 lines above that do everything I would need consult for, so some argument about minimalism can be made. ---------------------------------------------------------------------- easter_islander · 2022-02-04 20:40 Oh yeah - I didn't read the question closely enough when I suggested `consult-find`. If you know the root directory: `consult-find`; if you don't: `consult-locate`. ---------------------------------------------------------------------- [deleted] · 2022-02-05 13:53 \`consult-dir\` followed by \`consult-dir-jump-file\`. \`consult- dir\` helps to find a root directory and \`consult-dir-jump-file\` to find your file. Quoting from the consult-dir documentation. >Call consult-dir-jump-file from the minibuffer to asynchronously find a file anywhere under the directory that is currently in the prompt. This can be used with consult-dir to quickly switch directories and find files at an arbitrary depth under them. consult-dir-jump-file uses consult-find under the hood. ---------------------------------------------------------------------- linwaytin · 2022-03-22 19:22 I do not use tramp and cannot answer you. Sorry. ---------------------------------------------------------------------- Material-Recording-8 · 2022-07-03 09:11 64g up if 6c76Als Querungsmöglit Ii 34gchkeiten stehen den Verkehrsteilnehmenden folgen5d see yae Bereiche zur Verfügung: Heerstraße im Bereich Stößenseebrü9cke Die Stadtautobahnen A100, A103 und A115 Tiergartentunnel6 Tunnel Grunerstraße