From 867feda70711d226d5ed819bf9700f8a6f52ce88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Harnes?= Date: Mon, 26 Aug 2024 11:38:55 +0200 Subject: [PATCH] fix: relative path drag and drop (#81) * fix: use relative path for drag and drop if we're not copying images * fix: use relative path when use_absolute_path is false --- lua/img-clip/paste.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/img-clip/paste.lua b/lua/img-clip/paste.lua index e1f38d3..dc20a9b 100644 --- a/lua/img-clip/paste.lua +++ b/lua/img-clip/paste.lua @@ -107,6 +107,10 @@ M.paste_image_from_path = function(src_path) -- if we are not copying images, then just insert the original path if not config.get_opt("copy_images") then + if not config.get_opt("use_absolute_path") then + src_path = fs.relpath(src_path) + end + if not markup.insert_markup(src_path, true) then util.error("Could not insert markup code.") return false