mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 14:14:24 -05:00
Fix: make follow link work with brackets (closes #183)
Added col correction to lua/taglinks/taglinks.lua.
This commit is contained in:
@@ -13,6 +13,13 @@ M.is_tag_or_link_at = function(line, col, opts)
|
|||||||
local seen_hashtag = false
|
local seen_hashtag = false
|
||||||
local cannot_be_tag = 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
|
while col >= 1 do
|
||||||
char = line:sub(col, col)
|
char = line:sub(col, col)
|
||||||
|
|
||||||
|
|||||||
@@ -2190,8 +2190,8 @@ local function FollowLink(opts)
|
|||||||
-- we are in a link
|
-- we are in a link
|
||||||
vim.cmd("normal yi]")
|
vim.cmd("normal yi]")
|
||||||
title = vim.fn.getreg('"0')
|
title = vim.fn.getreg('"0')
|
||||||
title = remove_alias(title)
|
|
||||||
title = title:gsub("^(%[)(.+)(%])$", "%2")
|
title = title:gsub("^(%[)(.+)(%])$", "%2")
|
||||||
|
title = remove_alias(title)
|
||||||
else
|
else
|
||||||
-- we are in an external [link]
|
-- we are in an external [link]
|
||||||
vim.cmd("normal yi)")
|
vim.cmd("normal yi)")
|
||||||
|
|||||||
Reference in New Issue
Block a user