feat(api): add node.open.drop() (#2164)

Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
gegoune
2023-04-30 09:35:25 +02:00
committed by GitHub
parent 9c60947926
commit 0df384b6c0
3 changed files with 21 additions and 0 deletions

View File

@@ -160,6 +160,13 @@ local function open_file_in_tab(filename)
vim.cmd("tabe " .. vim.fn.fnameescape(filename))
end
local function drop(filename)
if M.quit_on_open then
view.close()
end
vim.cmd("drop " .. vim.fn.fnameescape(filename))
end
local function tab_drop(filename)
if M.quit_on_open then
view.close()
@@ -303,6 +310,10 @@ function M.fn(mode, filename)
return open_file_in_tab(filename)
end
if mode == "drop" then
return drop(filename)
end
if mode == "tab_drop" then
return tab_drop(filename)
end

View File

@@ -162,6 +162,7 @@ local function open_preview(node)
end
Api.node.open.edit = wrap_node(open_or_expand_or_dir_up "edit")
Api.node.open.drop = wrap_node(open_or_expand_or_dir_up "drop")
Api.node.open.tab_drop = wrap_node(open_or_expand_or_dir_up "tab_drop")
Api.node.open.replace_tree_buffer = wrap_node(open_or_expand_or_dir_up "edit_in_place")
Api.node.open.no_window_picker = wrap_node(open_or_expand_or_dir_up "edit_no_picker")