Merge pull request #282 from csams/issue-281

Fix FollowLink when searching tags.
This commit is contained in:
lambtho
2023-08-11 08:49:23 +00:00
committed by GitHub

View File

@@ -2086,6 +2086,7 @@ local function FollowLink(opts)
if opts.follow_tag ~= nil then if opts.follow_tag ~= nil then
kind = "tag" kind = "tag"
title = opts.follow_tag
if opts.templateDir ~= nil then if opts.templateDir ~= nil then
globArg = "--glob=!" .. "**/" .. opts.templateDir .. "/*.md" globArg = "--glob=!" .. "**/" .. opts.templateDir .. "/*.md"
end end
@@ -2095,10 +2096,12 @@ local function FollowLink(opts)
if kind == "tag" then if kind == "tag" then
search_mode = "tag" search_mode = "tag"
local saved_reg = vim.fn.getreg('"0') if title == nil then
vim.cmd("normal yiw") local saved_reg = vim.fn.getreg('"0')
title = vim.fn.getreg('"0') vim.cmd("normal yiw")
vim.fn.setreg('"0', saved_reg) title = vim.fn.getreg('"0')
vim.fn.setreg('"0', saved_reg)
end
else else
local saved_reg = vim.fn.getreg('"0') local saved_reg = vim.fn.getreg('"0')
if kind == "link" then if kind == "link" then