stevearc / oil.nvim

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

feature request: support for pasting deleted file that still exist in a register. #351

Open BartSte opened 5 months ago

BartSte commented 5 months ago

Did you check existing requests?

Describe the feature

Often the following occurs when I work with oil, as can be seen in the video:

https://github.com/stevearc/oil.nvim/assets/62509788/ceecbebf-4eae-4635-a77e-1c875bcba221

The follow happend:

This happens often to me. So I can either try to avoid this pattern, or support for pasting files that are deleted to a register could be added.

Provide background

No response

What is the significance of this feature?

strongly desired

Additional details

No response

stevearc commented 2 months ago

I've thought about this feature, and it would be really cool (allowing for seamless undo/redo in oil), but is incredibly difficult to do correctly. I haven't had the time to invest in this, and realistically probably won't.

For your particular use case, what may help is knowing that you can enter a directory before it is created. For example, you are doing:

  1. delete file
  2. create directory
  3. save
  4. enter directory
  5. paste
  6. save (error)

Instead you can do

  1. delete file
  2. create directory
  3. enter directory
  4. paste
  5. save
BartSte commented 2 months ago

Thanks for your reply. I can imagine it is not easy to implement.

I thought maybe files that still exist in one of the registries will not be removed, instead they are written to some kind of trash folder. From here, oil can retrieve them once the user tries to paste+save a delete file from the registry.

Most likely there are some caveats that I am missing here.