fix: do not show tags in template (closes 133)

This commit is contained in:
lambtho12
2022-05-18 13:52:59 +02:00
parent abe8e8b441
commit 08a785482d

View File

@@ -2132,10 +2132,14 @@ local function FollowLink(opts)
-- first: check if we're in a tag or a link -- first: check if we're in a tag or a link
local kind, atcol, tag local kind, atcol, tag
local globArg = ""
if opts.follow_tag ~= nil then if opts.follow_tag ~= nil then
kind = "tag" kind = "tag"
tag = opts.follow_tag tag = opts.follow_tag
if opts.templateDir ~= nil then
globArg = "--glob=!" .. "**/" .. opts.templateDir .. "/*.md"
end
else else
kind, atcol = check_for_link_or_tag() kind, atcol = check_for_link_or_tag()
end end
@@ -2498,6 +2502,7 @@ local function FollowLink(opts)
search_command = { search_command = {
"rg", "rg",
"--vimgrep", "--vimgrep",
globArg,
"-e", "-e",
prompt, prompt,
"--", "--",
@@ -2720,7 +2725,8 @@ 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) local templateDir = Path:new(M.Cfg.templates):make_relative(M.Cfg.home)
opts.templateDir = templateDir
if not global_dir_check() then if not global_dir_check() then
return return
@@ -2787,6 +2793,7 @@ local function FindAllTags(opts)
local follow_opts = { local follow_opts = {
follow_tag = selection, follow_tag = selection,
show_link_counts = true, show_link_counts = true,
templateDir = templateDir,
} }
actions._close(prompt_bufnr, false) actions._close(prompt_bufnr, false)
vim.schedule(function() vim.schedule(function()