@@ -68,6 +68,13 @@ function Builder:configure_git_icons_placement(where)
68
68
return self
69
69
end
70
70
71
+ function Builder :configure_modified (modified_icon , modified_placement , modified )
72
+ self .modified = modified
73
+ self .modified .icon = modified_icon
74
+ self .modified .placement = modified_placement
75
+ return self
76
+ end
77
+
71
78
function Builder :configure_symlink_destination (show )
72
79
self .symlink_destination = show
73
80
return self
@@ -206,15 +213,19 @@ function Builder:_highlight_opened_files(node, offset, icon_length, git_icons_le
206
213
self :_insert_highlight (" NvimTreeOpenedFile" , from , to )
207
214
end
208
215
209
- function Builder :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr )
216
+ function Builder :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr , modified )
210
217
local offset = string.len (padding )
211
218
212
219
local icon = self :_build_file_icon (node , offset )
213
220
214
221
local git_icons_starts_at = offset + # icon + (self .is_git_after and # node .name + 1 or 0 )
215
222
local git_icons = self :_unwrap_git_data (git_icons_tbl , git_icons_starts_at )
216
223
217
- self :_insert_line (self :_format_line (padding .. icon , node .name , git_icons ))
224
+ local name = node .name
225
+ if modified then
226
+ name = name .. self .modified .icon
227
+ end
228
+ self :_insert_line (self :_format_line (padding .. icon , name , git_icons ))
218
229
219
230
local git_icons_length = self .is_git_after and 0 or # git_icons
220
231
local col_start = offset + # icon + git_icons_length
@@ -263,6 +274,8 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
263
274
end
264
275
end
265
276
277
+ local modified = vim .fn .bufloaded (node .absolute_path ) > 0 and vim .fn .getbufinfo (node .absolute_path )[1 ].changed == 1
278
+
266
279
local is_folder = node .nodes ~= nil
267
280
local is_symlink = node .link_to ~= nil
268
281
@@ -271,7 +284,7 @@ function Builder:_build_line(node, idx, num_children, unloaded_bufnr)
271
284
elseif is_symlink then
272
285
self :_build_symlink (node , padding , git_highlight , git_icons_tbl )
273
286
else
274
- self :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr )
287
+ self :_build_file (node , padding , git_highlight , git_icons_tbl , unloaded_bufnr , modified )
275
288
end
276
289
self .index = self .index + 1
277
290
0 commit comments