feat: add actions.open_file.eject (#2341)
* feat: added prevent_buffer_override option to allow in-place opens by :e * Moved option check inside the callback * Renamed option to eject
This commit is contained in:
@@ -494,6 +494,7 @@ applying configuration.
|
|||||||
},
|
},
|
||||||
open_file = {
|
open_file = {
|
||||||
quit_on_open = false,
|
quit_on_open = false,
|
||||||
|
eject = true,
|
||||||
resize_window = true,
|
resize_window = true,
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@@ -1203,9 +1204,12 @@ Configuration for various actions.
|
|||||||
|
|
||||||
*nvim-tree.actions.open_file.quit_on_open*
|
*nvim-tree.actions.open_file.quit_on_open*
|
||||||
Closes the explorer when opening a file.
|
Closes the explorer when opening a file.
|
||||||
It will also disable preventing a buffer overriding the tree.
|
|
||||||
Type: `boolean`, Default: `false`
|
Type: `boolean`, Default: `false`
|
||||||
|
|
||||||
|
*nvim-tree.actions.open_file.eject*
|
||||||
|
Prevent new opened file from opening in the same window as the tree.
|
||||||
|
Type: `boolean`, Default: `true`
|
||||||
|
|
||||||
*nvim-tree.actions.open_file.resize_window* (previously `view.auto_resize`)
|
*nvim-tree.actions.open_file.resize_window* (previously `view.auto_resize`)
|
||||||
Resizes the tree when opening a file.
|
Resizes the tree when opening a file.
|
||||||
Type: `boolean`, Default: `true`
|
Type: `boolean`, Default: `true`
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ local function setup_autocommands(opts)
|
|||||||
create_nvim_tree_autocmd("BufWipeout", {
|
create_nvim_tree_autocmd("BufWipeout", {
|
||||||
pattern = "NvimTree_*",
|
pattern = "NvimTree_*",
|
||||||
callback = function()
|
callback = function()
|
||||||
if utils.is_nvim_tree_buf(0) then
|
if utils.is_nvim_tree_buf(0) and opts.actions.open_file.eject then
|
||||||
view._prevent_buffer_override()
|
view._prevent_buffer_override()
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
@@ -545,6 +545,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
|
|||||||
},
|
},
|
||||||
open_file = {
|
open_file = {
|
||||||
quit_on_open = false,
|
quit_on_open = false,
|
||||||
|
eject = true,
|
||||||
resize_window = true,
|
resize_window = true,
|
||||||
window_picker = {
|
window_picker = {
|
||||||
enable = true,
|
enable = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user