From 1a39187841f84b10e8018e0c2a1b6facc97163cc Mon Sep 17 00:00:00 2001 From: pseudometa <73286100+chrisgrieser@users.noreply.github.com> Date: Sat, 9 Sep 2023 23:38:44 +0200 Subject: [PATCH] Revert "Merge pull request #30 from BeauSLM/fix_directory_behaviors" This reverts commit dd5bc12769cede88988043d24b2838b18d09b1b7, reversing changes made to 683b42294410001e84ec50d93024bbe14c738db4. --- lua/genghis.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/genghis.lua b/lua/genghis.lua index 62cf397..b436b7a 100644 --- a/lua/genghis.lua +++ b/lua/genghis.lua @@ -33,7 +33,7 @@ end ---Performing common file operation tasks ---@param op string rename|duplicate|new|newFromSel local function fileOp(op) - local dir = fn.getcwd() + local dir = expand("%:p:h") local oldName = expand("%:t") local oldFilePath = expand("%:p") local oldNameNoExt = oldName:gsub("%.%w+$", "") @@ -96,7 +96,7 @@ local function fileOp(op) -- DETERMINE PATH AND EXTENSION local hasPath = newName:find("/") if hasPath then - local newFolder = vim.fs.dirname(newName) + local newFolder = newName:gsub("/.-$", "") fn.mkdir(newFolder, "p") -- create folders if necessary end