nvim-mini / nvim-mini/mini.nvim

Better buffer deletion in `buffers` picker

Open
#2,313 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request mini.pick
Dominant language
Lua
Stars
9.5k
Forks
310
Avg merge
4h 16m
Merged PRs (30d)
1

Description

Contributing guidelines
Module(s)

mini.pick

Description

I have a suggestion regarding the defaults for mini.pick
In the documentation mini.buffers has an example for adding mappings for deleting buffers. My issue is that deleting is not interactive if you have symbols enabled on deleting the symbol is gone but the name is still present we can provide this example instead.

vim.keymap.set('n', '<leader>bb', function()
  local wipeout_cur = function()
    buffer_items = MiniPick.get_picker_items()
    get_matched_bufnr = MiniPick.get_picker_matches().current.bufnr
    vim.api.nvim_buf_delete(get_matched_bufnr, {})
    for i = 1, #buffer_items do
      if buffer_items[i].bufnr == get_matched_bufnr then
        table.remove(buffer_items, i)
        break
      end
    end
    MiniPick.set_picker_items(buffer_items)
  end

  local buffer_mappings = {
    wipeout = {
      char = '<C-d>',
      func = wipeout_cur
    },
  }
  MiniPick.builtin.buffers(local_opts, { mappings = buffer_mappings })
end)

I can open a pull request if this suggestion looks valid to you.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the mini.pick picker implementation and the mini.buffers documentation example for buffer-deletion mappings. Reproduce deletion with symbols enabled, then determine whether the picker should refresh its items; done means the deleted buffer's symbol and name both disappear interactively, with relevant tests or documentation updated.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.