Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/nvim-tree/populate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ local function file_new(cwd, name)
name = name,
absolute_path = absolute_path,
executable = is_exec,
extension = vim.fn.fnamemodify(name, ':e') or "",
extension = string.match(name, ".?[^.]+%.(.*)") or "",
match_name = path_to_matching_str(name),
match_path = path_to_matching_str(absolute_path),
}
Expand Down
5 changes: 4 additions & 1 deletion lua/nvim-tree/renderer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,14 @@ if icon_state.show_file_icon then
get_file_icon = function(fname, extension, line, depth)
local icon, hl_group = web_devicons.get_icon(fname, extension)

if icon then
if icon and hl_group ~= "DevIconDefault" then
if hl_group then
table.insert(hl, { hl_group, line, depth, depth + #icon + 1 })
end
return icon.." "
elseif string.match(extension, "%.(.*)") then
-- If there are more extensions to the file, try to grab the icon for them recursively
return get_file_icon(fname, string.match(extension, "%.(.*)"), line, depth)
else
return #icon_state.icons.default > 0 and icon_state.icons.default.." " or ""
end
Expand Down