diff --git a/lua/genghis/operations/file.lua b/lua/genghis/operations/file.lua index ff18a90..c80d6d9 100644 --- a/lua/genghis/operations/file.lua +++ b/lua/genghis/operations/file.lua @@ -104,11 +104,15 @@ local function fileOp(op) end elseif op == "rename" or op == "move-rename" then rename.sendWillRenameToLsp(oldFilePath, newFilePath) - local success = rename.moveFile(oldFilePath, newFilePath) + local success, method = rename.moveFile(oldFilePath, newFilePath) if success then vim.cmd.edit(newFilePath) u.bwipeout("#") - u.notify(("Renamed %q to %q."):format(oldName, newName)) + if method == "git" then + u.notify(("Git renamed %q to %q."):format(oldName, newName)) + else + u.notify(("Renamed %q to %q."):format(oldName, newName)) + end if lspSupportsRenaming then vim.cmd.wall() end end elseif op == "new" or op == "new-from-selection" then diff --git a/lua/genghis/support/lsp-rename.lua b/lua/genghis/support/lsp-rename.lua index a68c1aa..d3c8644 100644 --- a/lua/genghis/support/lsp-rename.lua +++ b/lua/genghis/support/lsp-rename.lua @@ -68,7 +68,7 @@ function M.moveFile(oldFilePath, newFilePath) if isGitManagedFile(oldFilePath) then local renamed, git_mv_error = git_mv(oldFilePath, newFilePath) if renamed then - return true + return true, "git" else u.notify( ("File managed by git.\nFailed to rename using git mv %q:\n%q\nAttempting to rename using fs."):format( @@ -80,7 +80,7 @@ function M.moveFile(oldFilePath, newFilePath) end else local renamed, _ = vim.uv.fs_rename(oldFilePath, newFilePath) - if renamed then return true end + if renamed then return true, "fs" end end ---try `fs_copyfile` to support moving across partitions @@ -88,7 +88,7 @@ function M.moveFile(oldFilePath, newFilePath) if copied then local deleted, deletedError = vim.uv.fs_unlink(oldFilePath) if deleted then - return true + return true, "fs" else u.notify(("Failed to delete %q: %q"):format(oldFilePath, deletedError), "error") return false