diff options
| author | Dhruv Manilawala <dhruvmanila@gmail.com> | 2021-06-09 23:28:36 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-09 19:58:36 +0200 |
| commit | 495f84fd35e7b5bb0bb670e232725924b3b85b88 (patch) | |
| tree | a975832ce28ea2f53fb27a60ddc2609652b3cf29 /lua/telescope/actions/init.lua | |
| parent | 618e0e6075b4215e43c6a848daa37ef4e354b5dc (diff) | |
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",
}
}
}
}
}
```
Diffstat (limited to 'lua/telescope/actions/init.lua')
| -rw-r--r-- | lua/telescope/actions/init.lua | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lua/telescope/actions/init.lua b/lua/telescope/actions/init.lua index f7864a9..8a2f2d7 100644 --- a/lua/telescope/actions/init.lua +++ b/lua/telescope/actions/init.lua @@ -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. -- ================================================== |
