mirror of
https://github.com/Ascyii/telekasten.nvim.git
synced 2026-01-01 06:14:23 -05:00
Merge pull request #259 from aidangrigg/yank-register-fix
fix: TK functions no longer override default registers (closes #184)
This commit is contained in:
@@ -1323,8 +1323,10 @@ local function PreviewImg(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local saved_reg = vim.fn.getreg('"0')
|
||||||
vim.cmd("normal yi)")
|
vim.cmd("normal yi)")
|
||||||
local fname = vim.fn.getreg('"0'):gsub("^img/", "")
|
local fname = vim.fn.getreg('"0'):gsub("^img/", "")
|
||||||
|
vim.fn.setreg('"0', saved_reg)
|
||||||
|
|
||||||
-- check if fname exists anywhere
|
-- check if fname exists anywhere
|
||||||
local imageDir = M.Cfg.image_subdir or M.Cfg.home
|
local imageDir = M.Cfg.image_subdir or M.Cfg.home
|
||||||
@@ -1429,8 +1431,11 @@ local function FindFriends(opts)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local saved_reg = vim.fn.getreg('"0')
|
||||||
vim.cmd("normal yi]")
|
vim.cmd("normal yi]")
|
||||||
local title = vim.fn.getreg('"0')
|
local title = vim.fn.getreg('"0')
|
||||||
|
vim.fn.setreg('"0', saved_reg)
|
||||||
|
|
||||||
title = linkutils.remove_alias(title)
|
title = linkutils.remove_alias(title)
|
||||||
title = title:gsub("^(%[)(.+)(%])$", "%2")
|
title = title:gsub("^(%[)(.+)(%])$", "%2")
|
||||||
|
|
||||||
@@ -2003,6 +2008,7 @@ local function FollowLink(opts)
|
|||||||
search_mode = "tag"
|
search_mode = "tag"
|
||||||
title = tag
|
title = tag
|
||||||
else
|
else
|
||||||
|
local saved_reg = vim.fn.getreg('"0')
|
||||||
if kind == "link" then
|
if kind == "link" then
|
||||||
-- we are in a link
|
-- we are in a link
|
||||||
vim.cmd("normal yi]")
|
vim.cmd("normal yi]")
|
||||||
@@ -2015,6 +2021,7 @@ local function FollowLink(opts)
|
|||||||
local url = vim.fn.getreg('"0')
|
local url = vim.fn.getreg('"0')
|
||||||
return follow_url(url)
|
return follow_url(url)
|
||||||
end
|
end
|
||||||
|
vim.fn.setreg('"0', saved_reg)
|
||||||
|
|
||||||
local parts = vim.split(title, "#")
|
local parts = vim.split(title, "#")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user