stevearc / oil.nvim

Neovim file explorer: edit your filesystem like a buffer
MIT License
3.4k stars 92 forks source link

feature request: API for applying new file names / locations #369

Closed pidgeon777 closed 2 months ago

pidgeon777 commented 2 months ago

Did you check existing requests?

Describe the feature

Some plugins involves renaming files and/or moving them to different locations.

It would be good for oil.nvim to provide an API so that for example two tables are passed as arguments, associated to the source and destination files, so that oil.nvim is used to perform this risky file moving / rename operation inside Neovim.

Provide background

No response

What is the significance of this feature?

nice to have

Additional details

No response

pidgeon777 commented 2 months ago

Also, oil.nvim preview window could appear before applying the changes, as in the current implementation.

stevearc commented 2 months ago

I don't think oil should be in the business of being a library for other plugin authors. Handling move/rename logic correctly does seem like a bit of common logic that would be helpful to share, but I think the best place for it would be Neovim core. There was some discussion of this idea in https://github.com/neovim/neovim/pull/26516, and the conclusion was that they're not interested in adding an API for handling these operations until there is also functionality in core that uses that API. It's a long game, but probably the best way to get this is to first either convince them to add a new file manager to core (vim-dirvish is the most likely candidate) or add some commands like :Rename and :Delete, similar to vim-eunuch. From there the case could be made to better support LSP operations, and to make the resulting API public.