排除 .git 目录的文件查找结果

在 <leader>ff(文件查找)和 <leader>fa(查找所有文件)的 rg 命令中
添加 --glob "!.git/" 参数,避免搜索结果中出现 .git 目录下的内部文件。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-28 17:39:35 +08:00
parent 395c589993
commit 5e2334fc33

View File

@ -331,7 +331,7 @@ end, { desc = "诊断位置列表" })
-- <leader>ff :文件查找
lazy.on_keys("pick", "<leader>ff", "n", pick.load_pick, function()
require("mini.pick").builtin.cli({
command = { "rg", "--files", "--hidden", "--color=never" },
command = { "rg", "--files", "--hidden", "--glob", "!.git/", "--color=never" },
})
end, { desc = "文件查找" })
@ -348,7 +348,7 @@ end, { desc = "搜索键位映射" })
-- <leader>fa :查找所有文件(含隐藏和忽略的文件)
lazy.on_keys("pick", "<leader>fa", "n", pick.load_pick, function()
require("mini.pick").builtin.cli({
command = { "rg", "--files", "--hidden", "--no-ignore", "--color=never" },
command = { "rg", "--files", "--hidden", "--no-ignore", "--glob", "!.git/", "--color=never" },
})
end, { desc = "查找所有文件(含隐藏/忽略)" })