首页 > 解决方案 > .gitignore node_modules/ 不适用于 fd 和 ripgrep

问题描述

我正在尝试在 Windows 10 上为 vim设置fzf.vim 。

您可以使用应该尊重 .gitignore的替代 find 命令,例如ripgrepfd

我的 .gitignore 文件有这一行,它适用于 git 提交等:

node_modules/

我的目录结构是

/working directory
.gitignore file
.git  dir
/node_modules dir

当我跑

fd --type f

或者

rg --files

它列出了 node_modules 中的所有文件。

我觉得这可能是一个Windows问题。

如何让这些程序使用 .gitignore 来忽略 node_modules?

标签: fzfripgrepvim-fzf

解决方案


原来,我正在使用一个尚未初始化 git repo 的项目。所以我有一个 .gitignore,但没有 .git 文件夹。默认情况下,ripgrep 需要它是一个实际的 git 存储库才能使用 .gitiginore 文件夹。我的解决方案是使用以下标志 -

--no-require-git

更多信息在这里


推荐阅读