File tree Expand file tree Collapse file tree 4 files changed +41
-6
lines changed Expand file tree Collapse file tree 4 files changed +41
-6
lines changed Original file line number Diff line number Diff line change @@ -313,6 +313,15 @@ Subsequent calls to setup will replace the previous configuration.
313
313
max_folder_discovery = 300,
314
314
exclude = {},
315
315
},
316
+ file_popup = {
317
+ open_win_config = {
318
+ col = 1,
319
+ row = 1,
320
+ relative = "cursor",
321
+ border = "shadow",
322
+ style = "minimal",
323
+ },
324
+ },
316
325
open_file = {
317
326
quit_on_open = false,
318
327
resize_window = true,
@@ -869,6 +878,22 @@ Configuration for various actions.
869
878
E.g `{ ".git", "target", "build" }` etc.
870
879
Type: `table` , Default: `{}`
871
880
881
+ *nvim-tree.actions.file_popup*
882
+ Configuration for file_popup behaviour.
883
+
884
+ *nvim-tree.actions.file_popup.open_win_config*
885
+ Floating window config for file_popup. See | nvim_open_win | for more details.
886
+ You shouldn't define `" width" ` and `" height" ` values here. They will be
887
+ overridden to fit the file_popup content.
888
+ Type: `table` , Default:
889
+ `{`
890
+ `col = 1,`
891
+ `row = 1,`
892
+ `relative = "cursor",`
893
+ `border = "shadow",`
894
+ `style = "minimal",`
895
+ `}`
896
+
872
897
*nvim-tree.actions.open_file*
873
898
Configuration options for opening a file from nvim-tree.
874
899
Original file line number Diff line number Diff line change @@ -576,6 +576,15 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
576
576
max_folder_discovery = 300 ,
577
577
exclude = {},
578
578
},
579
+ file_popup = {
580
+ open_win_config = {
581
+ col = 1 ,
582
+ row = 1 ,
583
+ relative = " cursor" ,
584
+ border = " shadow" ,
585
+ style = " minimal" ,
586
+ },
587
+ },
579
588
open_file = {
580
589
quit_on_open = false ,
581
590
resize_window = true ,
Original file line number Diff line number Diff line change @@ -389,6 +389,7 @@ local DEFAULT_MAPPING_CONFIG = {
389
389
function M .setup (opts )
390
390
require (" nvim-tree.actions.fs.trash" ).setup (opts )
391
391
require (" nvim-tree.actions.node.system-open" ).setup (opts )
392
+ require (" nvim-tree.actions.node.file-popup" ).setup (opts )
392
393
require (" nvim-tree.actions.node.open-file" ).setup (opts )
393
394
require (" nvim-tree.actions.root.change-dir" ).setup (opts )
394
395
require (" nvim-tree.actions.fs.create-file" ).setup (opts )
Original file line number Diff line number Diff line change @@ -28,16 +28,12 @@ local function setup_window(node)
28
28
local max_width = vim .fn .max (vim .tbl_map (function (n )
29
29
return # n
30
30
end , lines ))
31
- local winnr = a .nvim_open_win (0 , false , {
32
- col = 1 ,
33
- row = 1 ,
34
- relative = " cursor" ,
31
+ local open_win_config = vim .tbl_extend (" force" , M .open_win_config , {
35
32
width = max_width + 1 ,
36
33
height = # lines ,
37
- border = " shadow" ,
38
34
noautocmd = true ,
39
- style = " minimal" ,
40
35
})
36
+ local winnr = a .nvim_open_win (0 , false , open_win_config )
41
37
current_popup = {
42
38
winnr = winnr ,
43
39
file_path = node .absolute_path ,
@@ -78,4 +74,8 @@ function M.toggle_file_info(node)
78
74
})
79
75
end
80
76
77
+ function M .setup (opts )
78
+ M .open_win_config = opts .actions .file_popup .open_win_config
79
+ end
80
+
81
81
return M
You can’t perform that action at this time.
0 commit comments