Fix: make follow link work with brackets (closes #183)

Added col correction to lua/taglinks/taglinks.lua.
This commit is contained in:
Ilia Ilinykh
2022-11-21 11:07:27 +03:00
committed by GitHub
parent ff85b22fb4
commit f4f836d4b4
2 changed files with 8 additions and 1 deletions

View File

@@ -13,6 +13,13 @@ M.is_tag_or_link_at = function(line, col, opts)
local seen_hashtag = false
local cannot_be_tag = false
-- Solves [[Link]]
-- at ^
-- In this case we try to move col forward to match the link.
if "[" == line:sub(col, col) then
col = math.max(col + 1, string.len(line))
end
while col >= 1 do
char = line:sub(col, col)

View File

@@ -2190,8 +2190,8 @@ local function FollowLink(opts)
-- we are in a link
vim.cmd("normal yi]")
title = vim.fn.getreg('"0')
title = remove_alias(title)
title = title:gsub("^(%[)(.+)(%])$", "%2")
title = remove_alias(title)
else
-- we are in an external [link]
vim.cmd("normal yi)")