feat: delete entry from the picker without closing telescope (#828)

This action is not mapped but you can do it yourself in your telescope setup call
Example config:
```lua
require("telescope").setup {
  pickers = {
    buffers = {
      mappings = {
        i = {
          ["<c-d>"] = "delete_buffer",
        }
      }
    }
  }
}
```
This commit is contained in:
Dhruv Manilawala
2021-06-09 23:28:36 +05:30
committed by GitHub
parent 618e0e6075
commit 495f84fd35
3 changed files with 77 additions and 3 deletions

View File

@@ -650,6 +650,15 @@ actions.open_loclist = function(_)
vim.cmd [[lopen]]
end
--- Delete the selected buffer or all the buffers selected using multi selection.
---@param prompt_bufnr number: The prompt bufnr
actions.delete_buffer = function(prompt_bufnr)
local current_picker = action_state.get_current_picker(prompt_bufnr)
current_picker:delete_selection(function(selection)
vim.api.nvim_buf_delete(selection.bufnr, { force = true })
end)
end
-- ==================================================
-- Transforms modules and sets the corect metatables.
-- ==================================================