File tree 3 files changed +18
-4
lines changed 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,20 @@ function M.is_git_ignored(node)
128
128
return node and node .git_status ~= nil and node .git_status .file == " !!"
129
129
end
130
130
131
+ --- @param node Node
132
+ --- @return boolean
133
+ function M .is_dotfile (node )
134
+ if node == nil then
135
+ return false
136
+ end
137
+ -- Inspect(node)
138
+ if node .is_dot or (node .name and (node .name :sub (1 , 1 ) == " ." )) or M .is_dotfile (node .parent ) then
139
+ node .is_dot = true
140
+ return true
141
+ end
142
+ return false
143
+ end
144
+
131
145
--- @param node Node
132
146
function M .node_destroy (node )
133
147
if not node then
Original file line number Diff line number Diff line change 9
9
--- @field fs_stat uv.fs_stat.result | nil
10
10
--- @field git_status GitStatus | nil
11
11
--- @field hidden boolean
12
+ --- @field is_dot boolean
12
13
--- @field name string
13
14
--- @field parent DirNode
14
15
--- @field type string
Original file line number Diff line number Diff line change 1
- local buffers = require " nvim-tree.buffers"
2
-
1
+ local is_dotfile = require (" nvim-tree.explorer.node" ).is_dotfile
3
2
local HL_POSITION = require (" nvim-tree.enum" ).HL_POSITION
4
3
local ICON_PLACEMENT = require (" nvim-tree.enum" ).ICON_PLACEMENT
5
4
38
37
--- @param node Node
39
38
--- @return HighlightedString[] | nil icons
40
39
function DecoratorHidden :calculate_icons (node )
41
- if self .enabled and (node . name : sub ( 1 , 1 ) == " . " ) then
40
+ if self .enabled and is_dotfile (node ) then
42
41
return { self .icon }
43
42
end
44
43
end
47
46
--- @param node Node
48
47
--- @return string | nil group
49
48
function DecoratorHidden :calculate_highlight (node )
50
- if not self .enabled or self .hl_pos == HL_POSITION .none or not (node . name : sub ( 1 , 1 ) == " . " ) then
49
+ if not self .enabled or self .hl_pos == HL_POSITION .none or not (is_dotfile ( node ) ) then
51
50
return nil
52
51
end
53
52
You can’t perform that action at this time.
0 commit comments