fix coloring without vim-devicons
This commit is contained in:
@@ -52,10 +52,9 @@ nnoremap <leader>n :LuaTreeRefresh<CR>
|
|||||||

|

|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
- add docs
|
- use libuv functions instead of `touch` and `mkdir` in `create_file()` and allow file creation with path like `foo/bar/baz`
|
||||||
- fix coloring when no dev icons
|
- better vim help docs
|
||||||
- cd command to move faster accross the fs if needed
|
- cd command to move faster accross the fs if needed
|
||||||
- quickly find file in the directory structure
|
- 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 side no matter what
|
||||||
- tree should always stay on the left no matter what
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
local api = vim.api
|
local api = vim.api
|
||||||
|
|
||||||
|
local HAS_DEV_ICONS = api.nvim_call_function('exists', { "*WebDevIconsGetFileTypeSymbol" }) == 1
|
||||||
|
|
||||||
local function get_padding(depth)
|
local function get_padding(depth)
|
||||||
local str = ""
|
local str = ""
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ local function dev_icons(pathname, isdir, open)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function get_icon_func_gen()
|
local function get_icon_func_gen()
|
||||||
if api.nvim_call_function('exists', { "*WebDevIconsGetFileTypeSymbol" }) == 1 then
|
if HAS_DEV_ICONS then
|
||||||
return dev_icons
|
return dev_icons
|
||||||
else
|
else
|
||||||
return default_icons
|
return default_icons
|
||||||
@@ -136,7 +138,7 @@ local function highlight_line(buffer)
|
|||||||
elseif is_pic(node.path .. node.name) then
|
elseif is_pic(node.path .. node.name) then
|
||||||
highlight('LuaTreeImageFile', line, text_start + gitlen, -1)
|
highlight('LuaTreeImageFile', line, text_start + gitlen, -1)
|
||||||
|
|
||||||
else
|
elseif HAS_DEV_ICONS then
|
||||||
for k, v in pairs(HIGHLIGHT_GROUPS) do
|
for k, v in pairs(HIGHLIGHT_GROUPS) do
|
||||||
if string.match(node.name, k) ~= nil then
|
if string.match(node.name, k) ~= nil then
|
||||||
text_start = text_start + 4
|
text_start = text_start + 4
|
||||||
|
|||||||
Reference in New Issue
Block a user