fix(view): prevent buffer override when actions.open_file.quit_on_open
* fix(view): prevent open buffer on NvimTree window when actions.open_file.quit_on_open is true * fix(view): add view.quit_on_open function to prevent open on NvimTree window Co-authored-by: btstream <btstream@gmail.com>
This commit is contained in:
@@ -366,7 +366,7 @@ local function setup_autocommands(opts)
|
|||||||
if not opts.actions.open_file.quit_on_open then
|
if not opts.actions.open_file.quit_on_open then
|
||||||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view._prevent_buffer_override })
|
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view._prevent_buffer_override })
|
||||||
else
|
else
|
||||||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view.abandon_current_window })
|
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view.quit_on_open })
|
||||||
end
|
end
|
||||||
|
|
||||||
if opts.hijack_directories.enable then
|
if opts.hijack_directories.enable then
|
||||||
|
|||||||
@@ -272,6 +272,11 @@ function M.abandon_current_window()
|
|||||||
M.View.tabpages[tab].winnr = nil
|
M.View.tabpages[tab].winnr = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.quit_on_open()
|
||||||
|
M._prevent_buffer_override()
|
||||||
|
M.abandon_current_window()
|
||||||
|
end
|
||||||
|
|
||||||
function M.is_visible(opts)
|
function M.is_visible(opts)
|
||||||
if opts and opts.any_tabpage then
|
if opts and opts.any_tabpage then
|
||||||
for _, v in pairs(M.View.tabpages) do
|
for _, v in pairs(M.View.tabpages) do
|
||||||
|
|||||||
Reference in New Issue
Block a user