mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
fix: do not look for tags in template dir
This commit is contained in:
@@ -10,6 +10,14 @@ local yaml_re =
|
|||||||
local function command_find_all_tags(opts)
|
local function command_find_all_tags(opts)
|
||||||
opts = opts or {}
|
opts = opts or {}
|
||||||
opts.cwd = opts.cwd 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
|
local re = hashtag_re
|
||||||
|
|
||||||
if opts.tag_notation == ":tag:" then
|
if opts.tag_notation == ":tag:" then
|
||||||
@@ -20,7 +28,16 @@ local function command_find_all_tags(opts)
|
|||||||
re = yaml_re
|
re = yaml_re
|
||||||
end
|
end
|
||||||
|
|
||||||
return "rg", { "--vimgrep", "--pcre2", "-o", re, "--", opts.cwd }
|
return "rg",
|
||||||
|
{
|
||||||
|
"--vimgrep",
|
||||||
|
"--pcre2",
|
||||||
|
globArg,
|
||||||
|
"-o",
|
||||||
|
re,
|
||||||
|
"--",
|
||||||
|
opts.cwd,
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- strips away leading ' or " , then trims whitespace
|
-- strips away leading ' or " , then trims whitespace
|
||||||
|
|||||||
@@ -2720,6 +2720,7 @@ local function FindAllTags(opts)
|
|||||||
local i = opts.i
|
local i = opts.i
|
||||||
opts.cwd = M.Cfg.home
|
opts.cwd = M.Cfg.home
|
||||||
opts.tag_notation = M.Cfg.tag_notation
|
opts.tag_notation = M.Cfg.tag_notation
|
||||||
|
opts.templateDir = Path:new(M.Cfg.templates):make_relative(M.Cfg.home)
|
||||||
|
|
||||||
if not global_dir_check() then
|
if not global_dir_check() then
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user