File tree Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Expand file tree Collapse file tree 4 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -458,6 +458,7 @@ applying configuration.
458
458
ignore = true,
459
459
show_on_dirs = true,
460
460
show_on_open_dirs = true,
461
+ disable_for_dirs = {},
461
462
timeout = 400,
462
463
},
463
464
modified = {
@@ -525,8 +526,7 @@ applying configuration.
525
526
trash = true,
526
527
},
527
528
},
528
- experimental = {
529
- },
529
+ experimental = {},
530
530
log = {
531
531
enable = false,
532
532
truncate = false,
@@ -734,6 +734,11 @@ Git integration with icons and colors.
734
734
Only relevant when `git.show_on_dirs` is `true` .
735
735
Type: `boolean ` , Default: `true`
736
736
737
+ *nvim-tree.git.disable_for_dirs*
738
+ Disable git integration when git top-level matches these paths.
739
+ May be relative, evaluated via | fnamemodify | `" :p" `
740
+ Type: `table` , Default: `{}`
741
+
737
742
*nvim-tree.git.timeout*
738
743
Kills the git process after some time if it takes too long.
739
744
Git integration will be disabled after 10 git jobs exceed this timeout.
Original file line number Diff line number Diff line change @@ -492,6 +492,7 @@ local DEFAULT_OPTS = { -- BEGIN_DEFAULT_OPTS
492
492
ignore = true ,
493
493
show_on_dirs = true ,
494
494
show_on_open_dirs = true ,
495
+ disable_for_dirs = {},
495
496
timeout = 400 ,
496
497
},
497
498
modified = {
Original file line number Diff line number Diff line change @@ -107,7 +107,16 @@ function M.get_project_root(cwd)
107
107
return nil
108
108
end
109
109
110
- M .cwd_to_project_root [cwd ] = git_utils .get_toplevel (cwd )
110
+ local toplevel = git_utils .get_toplevel (cwd )
111
+ for _ , disabled_for_dir in ipairs (M .config .git .disable_for_dirs ) do
112
+ local toplevel_norm = vim .fn .fnamemodify (toplevel , " :p" )
113
+ local disabled_norm = vim .fn .fnamemodify (disabled_for_dir , " :p" )
114
+ if toplevel_norm == disabled_norm then
115
+ return nil
116
+ end
117
+ end
118
+
119
+ M .cwd_to_project_root [cwd ] = toplevel
111
120
return M .cwd_to_project_root [cwd ]
112
121
end
113
122
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ local log = require "nvim-tree.log"
3
3
4
4
local has_cygpath = vim .fn .executable " cygpath" == 1
5
5
6
+ --- Retrieve the git toplevel directory
7
+ --- @param cwd string path
8
+ --- @return string | nil toplevel absolute path
6
9
function M .get_toplevel (cwd )
7
10
local profile = log .profile_start (" git toplevel %s" , cwd )
8
11
You can’t perform that action at this time.
0 commit comments