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

@ -52,10 +52,9 @@ nnoremap <leader>n :LuaTreeRefresh<CR>
![alt text](.github/tree.png?raw=true "file explorer")
## TODO
- add docs
- fix coloring when no dev icons
- use libuv functions instead of `touch` and `mkdir` in `create_file()` and allow file creation with path like `foo/bar/baz`
- better vim help docs
- cd command to move faster accross the fs if needed
- quickly find file in the directory structure
- use libuv functions instead of `touch` and `mkdir` in `create_file()` and allow file creation with path like `foo/bar/baz`
- tree should always stay on the left no matter what
- tree should always stay on the side no matter what

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