Skip to content

Conversation

pr4th4m
Copy link
Contributor

@pr4th4m pr4th4m commented Aug 28, 2023

API to trash bulk files using external trash cli or similar

Tested with

OS: MacOS Ventura

CLI:

  1. https://hasseg.org/trash/
    • This CLI has "put back" option on macos but needs a flag to be added in nvim-tree configure
     trash = {
        cmd = "trash -F",
     },
  2. https://github.com/sindresorhus/trash-cli

Keybinding:

Add below keybinding to trash bulk files

vim.keymap.set('n', 'bt',    api.marks.bulk.trash,                  opts('Trash Bookmarked'))

@alex-courtis alex-courtis changed the title Feature: Bulk trash api feat: add api.marks.bulk.trash Sep 2, 2023
Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks for your contribution. We do need some work:

  • remove unnecessary refresh
  • handle ui.confirm.trash = false

Testing:
OK:
mark and trash files and folders - y
mark and trash - n
mark and trash - rubbish trash.cmd
nothing marked
filesystem_watchers.enable = false
Event.WillRemoveFile
Event.FileRemoved
Event.FolderRemoved
Fail:
ui.confirm.trash = false - doesn't prompt

@alex-courtis
Copy link
Member

Many thanks for this one; trash is a useful feature.

@pr4th4m
Copy link
Contributor Author

pr4th4m commented Sep 14, 2023

ui.confirm.trash = false config should not prompt user, isn't it?
I think this works as expected in nvim

Screen.Recording.2023-09-14.at.8.10.03.pm.mov

Do you want me to handle any test cases related to ui.confirm.trash = false ? I couldn't find any though

@alex-courtis
Copy link
Member

ui.confirm.trash = false config should not prompt user, isn't it?
I think this works as expected in nvim

It is indeed working as expected. I cannot recall my thought process there. Please accept my apologies.

Re-tested a subset - it's all looking good.

Copy link
Member

@alex-courtis alex-courtis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works beautifully, many thanks for your contribution!

@alex-courtis alex-courtis merged commit 7f7665a into nvim-tree:master Sep 16, 2023
@pr4th4m
Copy link
Contributor Author

pr4th4m commented Sep 16, 2023

ui.confirm.trash = false config should not prompt user, isn't it?
I think this works as expected in nvim

It is indeed working as expected. I cannot recall my thought process there. Please accept my apologies.

Re-tested a subset - it's all looking good.

No worries mate, all good 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants