请问大家是如何在当前目录下快速递归搜索某个文件名的?

就是find-dired改了一下啊…

projectile慢我记得是因为它搜到以后还要sort一次.

我以为是从头开始写的。。。。惯性思维。。。

projectile 是确实慢很多。我profile下。

- command-execute                                       4,201,100,161  99%
 - apply                                                4,201,100,161  99%
  - ad-Advice-command-execute                           4,201,100,161  99%
   - #<compiled 0x1fe9b8f916af>                         4,201,100,161  99%
    - call-interactively                                4,201,100,161  99%
     - funcall-interactively                            4,201,100,161  99%
      - projectile-find-file                            4,172,020,246  99%
       - projectile--find-file                          4,172,020,246  99%
        - projectile-project-files                      4,059,587,649  96%
         - projectile-dir-files-alien                   4,059,587,649  96%
          - projectile-files-via-ext-command            4,059,554,651  96%
           - shell-command-to-string                    3,980,701,443  94%
            - shell-command                             3,905,556,140  92%
             - apply                                    3,905,556,140  92%
              - shell-command--shell-command-with-editor-mode 3,905,556,140  92%
               - #<compiled 0x1fe9b8fae1e1>             3,905,556,140  92%
                  call-process-shell-command            3,905,555,084  92%
                - push-mark                                     1,056   0%
                   apply                                        1,056   0%
            - buffer-string                                59,637,136   1%
             - apply                                       59,637,136   1%
                ad-Advice-buffer-string                    59,637,136   1%
            - #<compiled 0x1fe9b8fbef21>                       14,748   0%
             - kill-buffer                                     10,272   0%
              - run-hooks                                       8,188   0%
               - company-box--handle-window-changes             8,188   0%
                  company-box--get-frame                        8,188   0%
                tramp-flush-file-function                       2,084   0%
            - get-buffer-create                                 2,112   0%
             - run-hooks                                        2,112   0%
              - company-box--handle-window-changes              2,112   0%
                 company-box--get-frame                         2,112   0%
           - split-string                                  78,853,208   1%
              #<compiled 0x1fe9b8f62c19>                   78,842,236   1%
              string-match                                      8,924   0%
          - projectile-project-vcs                             32,998   0%
           - projectile-locate-dominating-file                 23,902   0%
              abbreviate-file-name                              5,666   0%
              projectile-file-exists-p                          1,704   0%
             projectile-file-exists-p                           9,096   0%
        - projectile-completing-read                      112,406,193   2%
         - ivy-read                                       112,397,011   2%
          - read-from-minibuffer                           91,724,935   2%
           - ivy--queue-exhibit                            86,763,528   2%
            - ivy--exhibit                                 86,763,528   2%
             - ivy--filter                                 82,418,637   1%
              - cl-remove-if-not                           50,593,141   1%
               - apply                                     50,593,141   1%
                - cl-remove                                50,593,141   1%
                   #<compiled 0x15813d6dfec5>                  13,378   0%
                   apply                                        4,589   0%
              + ivy--re-filter                             31,732,596   0%
              + ivy--regex-plus                                70,280   0%
                ivy--recompute-index                            2,112   0%
              + cl-search                                       1,056   0%
             + ivy--insert-minibuffer                       2,674,379   0%
             + ivy--format                                  1,666,312   0%
             + ivy--input                                       4,200   0%
           + timer-event-handler                            3,377,346   0%
           + redisplay_internal (C function)                  375,772   0%
           + eaf-monitor-key-event                             74,272   0%
           + #<compiled 0x15813a105501>                        22,958   0%
           + command-execute                                   20,344   0%
           + which-key--hide-popup                             14,784   0%
           + minibuffer-inactive-mode                          14,256   0%
           + minibuf-eldef-setup-minibuffer                     6,516   0%
           + run-hooks                                          2,112   0%
          + ivy--reset-state                                  110,094   0%
          + #<compiled 0x15813a143bcd>                          1,056   0%
         + projectile-prepend-project-name                      9,182   0%
        + projectile-project-root                              17,124   0%
        + projectile-maybe-invalidate-cache                     9,280   0%
      + counsel-M-x                                        20,577,334   0%
      + ivy-switch-buffer                                   8,502,581   0%

挖个坟

在Windows原生环境使用fd-dired,grep-dired和fzf不成功,前两者需要的xargs运行没有用,但是都调用了这个命令

我在网络上搜索到了两个链接

http://www.pirosa.co.uk/demo/wxargs/wxargs.html

尝试了,前者可以在命令行正常使用,后者根本没有反应

故来求教,各位大神指点一下windows在非cygwin这些环境下怎么使用模糊搜索来实现题主的要求,虽然我不抱太大希望,但是万一有惊喜呢

1 个赞

GitHub - redguardtoo/find-file-in-project: Quick access to project files in Emacsffip-lisp-find-file-in-project只用了Lisp和Emacs的API,在Windows下无需第三方命令行,而且没有编码问题。原生支持中文文件名。缺点就是比较慢。

默认是自动从项目根目录搜索。不过可以拓展为当前目录搜索。

(defun my-find-file-in-current-directory (&optional directory-p)
  (interactive "P")
  (let* ((ffip-project-root default-directory))
    (ffip-lisp-find-file-in-project directory-p)))

Grep 不知道。

windows下搜索用everything很快,可以和counsel-locate配合。

windows下我安装了个gow,linux的基本命令都有了

感谢大神指点,我尝试一下这个

配置之后可以正常搜索,不过如你所说确实比较慢,和fd在命令行的表现对比

谢谢您的指点,我去搜索一下相关资料,另外可否参考你的配置

这个没听说过,是类似于cygwin的模拟环境吗

你可以看一下这个贴子,我是在win7下用,配置比较奇怪,跟windows交互一般用gbk,写文件用utf8。emacs编码比较灵活,经过折腾这套方案在我机器上能工作。

感谢,另外想问一下,除了es,使用的时候是不是还是要打开everything

要开着,everything是gui工具,es是命令行。配合autohotkey,我把everything绑定成win+f,这样emacs外面搜索也方便,emacs内就用SPC f l 很方便。

我查了一下,可以用everything.exe -svc运行服务,貌似是没有everything的程序窗口了

我在启动Emacs的时候,加到了after-init里面

我只在Emacs里面使用

我的是这样,这样可以隐藏在状态栏那里:

(add-hook! 'emacs-startup-hook
  (w32-shell-execute "open" "~/.doom.d/ahk/my.ahk")
  (w32-shell-execute "open" "~/.doom.d/bin/everything/Everything.exe" "-startup"))
2 个赞

你那个帖子里面的代码报错

defadvice!这里!报错

你说了之后我就看到了

1 个赞

是后面多了个括号)

1 个赞

windows的话,安装git后,会有一套很完整的工具链,

(when (file-exists-p "C:/Program Files/Git/usr/bin")
 ;; (setq ffip-find-executable "\"c:\\Program Files\\Git\\usr\\bin\\find.exe\"") ; 如果你要用find-file-in-project的话取消注释
    (setenv "PATH"
            (concat
             "C:/Program Files/Git/usr/bin" ";"
             (getenv "PATH")
             )
            )
  nil)

直接复制bin目录能跨电脑使用吗,windows平台