Skip to content

Commit

Permalink
feat(common): add rename_basename to default actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dunix241 committed Oct 12, 2024
1 parent 8f8bf1c commit 130b2c7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/neo-tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ i = show_file_details Show file details in popup window, such as size

r = rename: Rename the selected file or directory.

E = rename_basename: Rename the selected file or directory without the
b = rename_basename: Rename the selected file or directory without the
extension.

y = copy_to_clipboard: Mark file to be copied.
Expand Down
2 changes: 1 addition & 1 deletion lua/neo-tree/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ local config = {
["A"] = "add_directory", -- also accepts the config.show_path and config.insert_as options.
["d"] = "delete",
["r"] = "rename",
-- ["b"] = "rename_basename",
["b"] = "rename_basename",
["y"] = "copy_to_clipboard",
["x"] = "cut_to_clipboard",
["p"] = "paste_from_clipboard",
Expand Down
6 changes: 3 additions & 3 deletions lua/neo-tree/sources/filesystem/lib/fs_actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,8 @@ end

-- Rename Node Base Name
M.rename_node_basename = function(path, callback)
local parent_path, _ = utils.split_path(path)
local name = vim.fn.fnamemodify(path, ":t:r")
local parent_path, name = utils.split_path(path)
local base_name = vim.fn.fnamemodify(path, ":t:r")
local extension = vim.fn.fnamemodify(path, ":e")

local msg = string.format('Enter new name for "%s":', name)
Expand All @@ -638,7 +638,7 @@ M.rename_node_basename = function(path, callback)
.. (extension:len() == 0 and "" or "." .. extension)
end

rename_node(msg, name, get_destination, path, callback)
rename_node(msg, base_name, get_destination, path, callback)
end

return M

0 comments on commit 130b2c7

Please sign in to comment.