feat: added support for tabdrop (#2143)
This commit is contained in:
@@ -2470,6 +2470,28 @@ actions.select_tab({prompt_bufnr}) *telescope.actions.select_tab()*
|
|||||||
{prompt_bufnr} (number) The prompt bufnr
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
|
actions.select_drop({prompt_bufnr}) *telescope.actions.select_drop()*
|
||||||
|
Perform 'drop' action on selection, usually something like
|
||||||
|
`:drop <selection>`
|
||||||
|
|
||||||
|
i.e. open the selection in a window
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
|
actions.select_tab_drop({prompt_bufnr}) *telescope.actions.select_tab_drop()*
|
||||||
|
Perform 'tab drop' action on selection, usually something like
|
||||||
|
`:tab drop <selection>`
|
||||||
|
|
||||||
|
i.e. open the selection in a new tab
|
||||||
|
|
||||||
|
|
||||||
|
Parameters: ~
|
||||||
|
{prompt_bufnr} (number) The prompt bufnr
|
||||||
|
|
||||||
|
|
||||||
actions.file_edit({prompt_bufnr}) *telescope.actions.file_edit()*
|
actions.file_edit({prompt_bufnr}) *telescope.actions.file_edit()*
|
||||||
Perform file edit on selection, usually something like
|
Perform file edit on selection, usually something like
|
||||||
`:edit <selection>`
|
`:edit <selection>`
|
||||||
|
|||||||
@@ -299,6 +299,38 @@ actions.select_tab = {
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- Perform 'drop' action on selection, usually something like<br>
|
||||||
|
---`:drop <selection>`
|
||||||
|
---
|
||||||
|
--- i.e. open the selection in a window
|
||||||
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
|
actions.select_drop = {
|
||||||
|
pre = function(prompt_bufnr)
|
||||||
|
action_state
|
||||||
|
.get_current_history()
|
||||||
|
:append(action_state.get_current_line(), action_state.get_current_picker(prompt_bufnr))
|
||||||
|
end,
|
||||||
|
action = function(prompt_bufnr)
|
||||||
|
return action_set.select(prompt_bufnr, "drop")
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Perform 'tab drop' action on selection, usually something like<br>
|
||||||
|
---`:tab drop <selection>`
|
||||||
|
---
|
||||||
|
--- i.e. open the selection in a new tab
|
||||||
|
---@param prompt_bufnr number: The prompt bufnr
|
||||||
|
actions.select_tab_drop = {
|
||||||
|
pre = function(prompt_bufnr)
|
||||||
|
action_state
|
||||||
|
.get_current_history()
|
||||||
|
:append(action_state.get_current_line(), action_state.get_current_picker(prompt_bufnr))
|
||||||
|
end,
|
||||||
|
action = function(prompt_bufnr)
|
||||||
|
return action_set.select(prompt_bufnr, "tab drop")
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
-- TODO: consider adding float!
|
-- TODO: consider adding float!
|
||||||
-- https://github.com/nvim-telescope/telescope.nvim/issues/365
|
-- https://github.com/nvim-telescope/telescope.nvim/issues/365
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ local edit_buffer
|
|||||||
do
|
do
|
||||||
local map = {
|
local map = {
|
||||||
drop = "drop",
|
drop = "drop",
|
||||||
|
["tab drop"] = "tab drop",
|
||||||
edit = "buffer",
|
edit = "buffer",
|
||||||
new = "sbuffer",
|
new = "sbuffer",
|
||||||
vnew = "vert sbuffer",
|
vnew = "vert sbuffer",
|
||||||
@@ -79,7 +80,7 @@ do
|
|||||||
if command == nil then
|
if command == nil then
|
||||||
error "There was no associated buffer command"
|
error "There was no associated buffer command"
|
||||||
end
|
end
|
||||||
if command ~= "drop" then
|
if command ~= "drop" and command ~= "tab drop" then
|
||||||
vim.cmd(string.format("%s %d", command, bufnr))
|
vim.cmd(string.format("%s %d", command, bufnr))
|
||||||
else
|
else
|
||||||
vim.cmd(string.format("%s %s", command, vim.api.nvim_buf_get_name(bufnr)))
|
vim.cmd(string.format("%s %s", command, vim.api.nvim_buf_get_name(bufnr)))
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ local select_to_edit_map = {
|
|||||||
horizontal = "new",
|
horizontal = "new",
|
||||||
vertical = "vnew",
|
vertical = "vnew",
|
||||||
tab = "tabedit",
|
tab = "tabedit",
|
||||||
|
drop = "drop",
|
||||||
|
["tab drop"] = "tab drop",
|
||||||
}
|
}
|
||||||
function action_state.select_key_to_edit_key(type)
|
function action_state.select_key_to_edit_key(type)
|
||||||
return select_to_edit_map[type]
|
return select_to_edit_map[type]
|
||||||
|
|||||||
Reference in New Issue
Block a user