From 6290e52f971980ee15ccaf9dc0e225a159a8f7cc Mon Sep 17 00:00:00 2001 From: Thomas Lambert Date: Sat, 11 Feb 2023 22:44:04 +0100 Subject: [PATCH] fix(followlink): create link with subdirs on the fly --- lua/telekasten.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index cbdc85e..a597ae0 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -272,7 +272,7 @@ local function check_dir_and_ask(dir, purpose) .. " Shall I create it? ", }, function(answer) if answer == "Yes" then - if Path:new(dir):mkdir({ exists_ok = false }) then + if Path:new(dir):mkdir({ parents=true, exists_ok = false }) then vim.cmd('echomsg " "') vim.cmd('echomsg "' .. dir .. ' created"') ret = true @@ -2257,6 +2257,12 @@ local function FollowLink(opts) end if search_mode == "files" then + + -- check if subdir exists + local filepath = title:match("(.*/)") or "" + filepath = M.Cfg.home .. "/" .. filepath + check_dir_and_ask(filepath, "") + -- check if fname exists anywhere local pinfo = Pinfo:new({ title = title }) if