From 5f19d27a9a6124b33f99a66778f4986fc587a065 Mon Sep 17 00:00:00 2001 From: lambtho12 Date: Tue, 18 Jan 2022 11:30:30 +0100 Subject: [PATCH] add: renaming in subdirs --- lua/telekasten.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lua/telekasten.lua b/lua/telekasten.lua index 8c1127c..76d5bd2 100644 --- a/lua/telekasten.lua +++ b/lua/telekasten.lua @@ -1421,11 +1421,15 @@ end -- local function RenameNote() local oldname = Pinfo:new({ filepath = vim.fn.expand("%:p"), M.Cfg }).title + local subdir = Pinfo:new({ filepath = vim.fn.expand("%:p"), M.Cfg }).sub_dir + local newname = vim.fn.input("New name: ") newname = newname:gsub("[" .. M.Cfg.extension .. "]+$", "") + local newpath = newname:match("(.*/)") - -- oldname should include subdir if subdirs_in_links = true - -- newname should automatically add subdir if subdirs_in_links = true and user did not add it themselves + if M.Cfg.subdirs_in_links == true and newpath == nil then + newname = subdir .. "/" .. newname + end -- could probably be improved substantially if newname ~= "" and newname ~= oldname then