|
56 | 56 |
|
57 | 57 | local get_file_icon = function() return "" end
|
58 | 58 | if icon_state.show_file_icon then
|
59 |
| - local web_devicons = require'nvim-web-devicons' |
| 59 | + if icon_state.has_devicons then |
| 60 | + local web_devicons = require'nvim-web-devicons' |
60 | 61 |
|
61 |
| - get_file_icon = function(fname, extension, line, depth) |
62 |
| - local icon, hl_group = web_devicons.get_icon(fname, extension) |
| 62 | + get_file_icon = function(fname, extension, line, depth) |
| 63 | + local icon, hl_group = web_devicons.get_icon(fname, extension) |
63 | 64 |
|
64 |
| - if icon and hl_group ~= "DevIconDefault" then |
65 |
| - if hl_group then |
66 |
| - table.insert(hl, { hl_group, line, depth, depth + #icon + 1 }) |
| 65 | + if icon and hl_group ~= "DevIconDefault" then |
| 66 | + if hl_group then |
| 67 | + table.insert(hl, { hl_group, line, depth, depth + #icon + 1 }) |
| 68 | + end |
| 69 | + return icon..icon_padding |
| 70 | + elseif string.match(extension, "%.(.*)") then |
| 71 | + -- If there are more extensions to the file, try to grab the icon for them recursively |
| 72 | + return get_file_icon(fname, string.match(extension, "%.(.*)"), line, depth) |
| 73 | + else |
| 74 | + return #icon_state.icons.default > 0 and icon_state.icons.default..icon_padding or "" |
67 | 75 | end
|
68 |
| - return icon..icon_padding |
69 |
| - elseif string.match(extension, "%.(.*)") then |
70 |
| - -- If there are more extensions to the file, try to grab the icon for them recursively |
71 |
| - return get_file_icon(fname, string.match(extension, "%.(.*)"), line, depth) |
72 |
| - else |
| 76 | + end |
| 77 | + else |
| 78 | + get_file_icon = function() |
73 | 79 | return #icon_state.icons.default > 0 and icon_state.icons.default..icon_padding or ""
|
74 | 80 | end
|
75 | 81 | end
|
76 |
| - |
77 | 82 | end
|
78 | 83 |
|
79 | 84 | local get_symlink_icon = function() return icon_state.icons.symlink end
|
|
0 commit comments