fix coloring without vim-devicons

This commit is contained in:
kiyan42
2020-02-20 21:48:16 +01:00
parent a8143a7ff1
commit 267b14fc5f
2 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
local api = vim.api
local HAS_DEV_ICONS = api.nvim_call_function('exists', { "*WebDevIconsGetFileTypeSymbol" }) == 1
local function get_padding(depth)
local str = ""
@@ -57,7 +59,7 @@ local function dev_icons(pathname, isdir, open)
end
local function get_icon_func_gen()
if api.nvim_call_function('exists', { "*WebDevIconsGetFileTypeSymbol" }) == 1 then
if HAS_DEV_ICONS then
return dev_icons
else
return default_icons
@@ -136,7 +138,7 @@ local function highlight_line(buffer)
elseif is_pic(node.path .. node.name) then
highlight('LuaTreeImageFile', line, text_start + gitlen, -1)
else
elseif HAS_DEV_ICONS then
for k, v in pairs(HIGHLIGHT_GROUPS) do
if string.match(node.name, k) ~= nil then
text_start = text_start + 4