emacs - how to make find-file search in subdirectories

后端 未结 4 768
小蘑菇
小蘑菇 2021-02-14 22:22

I\'d like to implement something like Resharper\'s "Go To File" feature for Emacs. When one presses mentioned shortcut, Resharper pops a text box that accepts a wildca

相关标签:
4条回答
  • 2021-02-14 22:58

    Have you tried helm yet? You can easily choose to search files, buffers, commands, and a lot of other things.

    0 讨论(0)
  • 2021-02-14 22:59

    Although you might not want to keep lots of buffers open, you can hook IDO into recentf, which tracks recently-opened files:

    (recentf-mode 1)
    (setq recentf-max-saved-items 300)
    
    (defun ido-choose-from-recentf ()
      "Use ido to select a recently opened file from the `recentf-list'"
      (interactive)
      (find-file (ido-completing-read "Open file: " recentf-list nil t)))
    
    (global-set-key [(meta f11)] 'ido-choose-from-recentf)
    

    I've been using this trick for years, and it's 99% of all the file-switching I need.

    Beyond that, I use M-x rgrep, and you might also like to look at M-x find-dired and M-x find-grep-dired.

    For more options still, check out the answers to this similar question.

    0 讨论(0)
  • 2021-02-14 23:01

    You mentioned Icicles, but you mistakenly thought that it "works shallowly". It works any way you want it to work. You can search for any file on your system, if you want, matching any part of the file name and path. And you can define a project of particular files and/or directories, save its definition, and later search only among those files/dirs. (Emacs filesets are a strict subset of this feature, but you can use filesets directly the same way.)

    This should help (see also the links at the end of that page):

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

    0 讨论(0)
  • 2021-02-14 23:21

    Projectile has a function named projectile-jump-to-project-file that does more or less what you want. There is also find-file-in-project - a simpler utility, but dependent on the presence of GNU find.

    0 讨论(0)
提交回复
热议问题