File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -494,6 +494,7 @@ applying configuration.
494
494
},
495
495
open_file = {
496
496
quit_on_open = false,
497
+ prevent_buffer_override = true,
497
498
resize_window = true,
498
499
window_picker = {
499
500
enable = true,
@@ -1203,9 +1204,12 @@ Configuration for various actions.
1203
1204
1204
1205
*nvim-tree.actions.open_file.quit_on_open*
1205
1206
Closes the explorer when opening a file.
1206
- It will also disable preventing a buffer overriding the tree.
1207
1207
Type: `boolean ` , Default: `false`
1208
1208
1209
+ *nvim-tree.actions.open_file.prevent_buffer_override*
1210
+ Prevent new opened file from opening in the same window as the tree.
1211
+ Type: `boolean ` , Default: `true`
1212
+
1209
1213
*nvim-tree.actions.open_file.resize_window* (previously `view .auto_resize` )
1210
1214
Resizes the tree when opening a file.
1211
1215
Type: `boolean ` , Default: `true`
Original file line number Diff line number Diff line change @@ -192,15 +192,17 @@ local function setup_autocommands(opts)
192
192
-- reset highlights when colorscheme is changed
193
193
create_nvim_tree_autocmd (" ColorScheme" , { callback = M .reset_highlight })
194
194
195
- -- prevent new opened file from opening in the same window as nvim-tree
196
- create_nvim_tree_autocmd (" BufWipeout" , {
197
- pattern = " NvimTree_*" ,
198
- callback = function ()
199
- if utils .is_nvim_tree_buf (0 ) then
200
- view ._prevent_buffer_override ()
201
- end
202
- end ,
203
- })
195
+ if opts .actions .open_file .prevent_buffer_override then
196
+ -- prevent new opened file from opening in the same window as nvim-tree
197
+ create_nvim_tree_autocmd (" BufWipeout" , {
198
+ pattern = " NvimTree_*" ,
199
+ callback = function ()
200
+ if utils .is_nvim_tree_buf (0 ) then
201
+ view ._prevent_buffer_override ()
202
+ end
203
+ end ,
204
+ })
205
+ end
204
206
205
207
create_nvim_tree_autocmd (" BufWritePost" , {
206
208
callback = function ()
@@ -545,6 +547,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
545
547
},
546
548
open_file = {
547
549
quit_on_open = false ,
550
+ prevent_buffer_override = true ,
548
551
resize_window = true ,
549
552
window_picker = {
550
553
enable = true ,
You can’t perform that action at this time.
0 commit comments