oil.nvim icon indicating copy to clipboard operation
oil.nvim copied to clipboard

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

Open BartSte opened this issue 1 year ago • 4 comments

Did you check existing requests?

  • [x] I have searched the existing issues

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:

  • Run nvim with a minimal config.
  • I delete a file called foo.txt to a register.
  • I create a directory foo.
  • I try to paste the foo.txt into the new directory.
  • This fails, as foo.txt does not exist anymore.

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

BartSte avatar Apr 16 '24 07:04 BartSte

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

stevearc avatar Jul 16 '24 22:07 stevearc

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.

BartSte avatar Jul 25 '24 05:07 BartSte