* fix: prevent quit_on_open from opening in same window * chore: remove condition for quit_on_open * fix: prevent opening file in a new window on floting nvim-tree * stylua Co-authored-by: Alexander Courtis <alex@courtis.org>
This commit is contained in:
@@ -335,6 +335,16 @@ local function setup_autocommands(opts)
|
||||
-- reset highlights when colorscheme is changed
|
||||
create_nvim_tree_autocmd("ColorScheme", { callback = M.reset_highlight })
|
||||
|
||||
-- prevent new opened file from opening in the same window as nvim-tree
|
||||
create_nvim_tree_autocmd("BufWipeout", {
|
||||
pattern = "NvimTree_*",
|
||||
callback = function()
|
||||
if vim.bo.filetype == "NvimTree" then
|
||||
view._prevent_buffer_override()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
local has_watchers = opts.filesystem_watchers.enable
|
||||
|
||||
if opts.auto_reload_on_write and not has_watchers then
|
||||
@@ -369,12 +379,6 @@ local function setup_autocommands(opts)
|
||||
})
|
||||
end
|
||||
|
||||
if not opts.actions.open_file.quit_on_open then
|
||||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view._prevent_buffer_override })
|
||||
else
|
||||
create_nvim_tree_autocmd("BufWipeout", { pattern = "NvimTree_*", callback = view.abandon_current_window })
|
||||
end
|
||||
|
||||
if opts.hijack_directories.enable then
|
||||
create_nvim_tree_autocmd({ "BufEnter", "BufNewFile" }, { callback = M.open_on_directory })
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user