vim-fern icon indicating copy to clipboard operation
vim-fern copied to clipboard

Deleting items not working somehow

Open alextes opened this issue 1 year ago • 5 comments

Hi (:

When I delete an item using fern it gives a little message "1 items are trashed", but nothing actually gets removed.

Could you point me in the right direction for debugging this?

I use an alias for 'rm' called safe-rm maybe it has something to do with that.

This functionality used to work fine for me. I'm not sure what changed.

Thanks for a great plugin 💛 !

alextes avatar Aug 29 '22 07:08 alextes

After digging through the help files and trash-cli I see fern offers to safely delete instead of outright shred your files forever, which is great. I usually don't need it due to git but sometimes it's nice. So for me, I guess it would work to be able to tell Fern, "hey, just use my shell's rm or this binary over there that works just like rm" (which is safe-rm).

I'm guessing what changed is that the default went from remove to trash recently. Which for me on macOS isn't working. Or perhaps macOS blocked nvim from using osascript somehow.

alextes avatar Aug 29 '22 07:08 alextes

So for me, I guess it would work to be able to tell Fern, "hey, just use my shell's rm or this binary over there that works just like rm" (which is safe-rm).

Unfortunately, fern itself does not provide such action (remove action use delete() function of Vim script). You can make it by yourselves.

I'm guessing what changed is that the default went from remove to trash recently.

Fern didn't change the behavior. The default behavior of D mapping is 'trash' action from very early version of fern.

Which for me on macOS isn't working. Or perhaps macOS blocked nvim from using osascript somehow.

Maybe? I'm sorry but I've no idea what's going on in your system.

lambdalisue avatar Aug 29 '22 07:08 lambdalisue

Okay @lambdalisue, thanks! Any pointer to docs on how I could bind "take the path of the thing under the cursor or these highlighted files (does Fern expose this somehow?) and pass all of them to safe-rm?

If there aren't that's okay, just close this issue and we'll leave it for someone with more vim skill than me to maybe build one day 😄 .

alextes avatar Aug 29 '22 08:08 alextes

Oh! and we haven't at all tried to debug why osascript isn't working, any idea how I could check what exactly is going wrong when fern tries to call macOS to tell it to trash something?

alextes avatar Aug 29 '22 08:08 alextes

Okay @lambdalisue, thanks! Any pointer to docs on how I could bind "take the path of the thing und

Fern provides docs for developers as :help fern-developer :+1:

Oh! and we haven't at all tried to debug why osascript isn't working, any idea how I could check what exactly is going wrong when fern tries to call macOS to tell it to trash something?

Try this function directly and see what's happen.

https://github.com/lambdalisue/fern.vim/blob/d134808916cb7ccd0800830032d07a0757ed68ee/autoload/vital/_fern/Async/File.vim#L232-L239

lambdalisue avatar Aug 29 '22 08:08 lambdalisue

@alextes Any update? Shall I close the issue?

lambdalisue avatar Oct 22 '22 07:10 lambdalisue

Oops, closed by mistake

lambdalisue avatar Oct 22 '22 07:10 lambdalisue

We can close, I switched to Lua based plugins.

This one served me well for a long time. Thanks!

alextes avatar Oct 22 '22 12:10 alextes

man that sucks, the trash suddenly stops working for me on OSX as well. Not sure why. If you have the recommendation on which to switch over that would be awesome.

Or if someone can help fix this that would be awesome too.

My workaround right now is to create a new mapping to run delete instead of trash https://github.com/lambdalisue/fern.vim/issues/366

pencilcheck avatar Aug 27 '23 01:08 pencilcheck