fix: do not look for tags in template dir

This commit is contained in:
lambtho12
2022-05-18 13:19:16 +02:00
parent b60eafa1ca
commit abe8e8b441
2 changed files with 19 additions and 1 deletions

View File

@@ -10,6 +10,14 @@ local yaml_re =
local function command_find_all_tags(opts)
opts = opts or {}
opts.cwd = opts.cwd or "."
opts.templateDir = opts.templateDir or ""
-- do not list tags in the template directory
local globArg = ""
if opts.templateDir ~= "" then
globArg = "--glob=!" .. "**/" .. opts.templateDir .. "/*.md"
end
local re = hashtag_re
if opts.tag_notation == ":tag:" then
@@ -20,7 +28,16 @@ local function command_find_all_tags(opts)
re = yaml_re
end
return "rg", { "--vimgrep", "--pcre2", "-o", re, "--", opts.cwd }
return "rg",
{
"--vimgrep",
"--pcre2",
globArg,
"-o",
re,
"--",
opts.cwd,
}
end
-- strips away leading ' or " , then trims whitespace