stevearc / oil.nvim

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

Allow files to be moved to non-existing directories #400

Closed plneple closed 3 months ago

plneple commented 4 months ago

Adds handling for non-existing directories for the MOVE command, similar to how CREATE works

plneple commented 3 months ago

@stevearc I was unaware that this idea has already been implemented, my bad.

There are several potential solutions I was able to come up with:

Please let me know if you find any of these acceptable.

EDIT: After reading the linked PR more carefully, I now see that the first option is not acceptable for this plugin.

stevearc commented 3 months ago

The ideal would be that if you :w with these changes, the save operation is blocked, an error is displayed, and a diagnostic is added to the offending line. This is currently how it works for similar behavior (e.g. creating two files with the same name).

Alternatively, there is a subset of this functionality that may be easier to add: allowing these files to be moved into a new directory, but not an existing one. This doesn't produce the same issues with filename collisions, and might be easier to code.