-
-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
Description
nvim-tree.lua/lua/nvim-tree/actions/fs/rename-file.lua
Lines 23 to 40 in aaee4cd
| function M.rename(node, to) | |
| local notify_from = notify.render_path(node.absolute_path) | |
| local notify_to = notify.render_path(to) | |
| if utils.file_exists(to) then | |
| notify.warn(err_fmt(notify_from, notify_to, "file already exists")) | |
| return | |
| end | |
| events._dispatch_will_rename_node(node.absolute_path, to) | |
| local success, err = vim.loop.fs_rename(node.absolute_path, to) | |
| if not success then | |
| return notify.warn(err_fmt(notify_from, notify_to, err)) | |
| end | |
| notify.info(notify_from .. " " .. notify_to) | |
| utils.rename_loaded_buffers(node.absolute_path, to) | |
| events._dispatch_node_renamed(node.absolute_path, to) | |
| end |
Describe the solution you'd like
The e and r don't respect git repo: by renaming something we loose track of file path history. I would like to be able to rename filepath by using git mv (instead of system command) in order to keep track of file renames:
git mv <src_path> <dst_path>
Currently, nvim-tree doesn't provide this feature forcing me to rename file by using git manually.
Describe alternatives you've considered
Running !git mv % <path_no_new_name> is rather clunky...
Running !git -A <path_no_new_name> is rather clunky and not something I want...
Can this functionality be implemented utilising API?
NO.
Additional context
I'ts difficult to easily contribute API feature, cause:
- The runner is not a generic lua wrapper for git:
- it's hard-wired to run only single git subcommand:
status - quite intricate interally - it's hard to extend
- no docs/comments
- This repo has no dedicated
gitwrapper for running & handling git output (there is a dedicated fast libgit2 lua bindings btw) - Intent of
nvim-tree.gitis unclear