Skip to content

Quick way to remove scratch buffers? #207

Answered by dpetka2001
gonstoll asked this question in Q&A
Discussion options

You must be logged in to vote

snacks uses vim.ui.select to list available Scratch buffers, but as far as I know it doesn't accept actions, like FzfLua or Telescope.

One solution would be to add a parameter to M.select(mode) and then check for example if it is "delete" to execute some additional logic to delete the file. But, in my personal opinion, that would soon escalate to other requests about additional actions and maybe that would be out of scope in the end.

Since you use FzfLua, you can take make your own custom picker by using the Scratch API to get the list of items. Something like the following should work I believe

function M.scratch_delete()
  local entries = {}  -- use this to populate the table with singl…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@gonstoll
Comment options

@dpetka2001
Comment options

@gonstoll
Comment options

Answer selected by gonstoll
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants