add config option to disable the icons
This commit is contained in:
parent
3678169bd6
commit
0b4c9d8143
@ -20,6 +20,8 @@ let g:lua_tree_size = 40 "30 by default
|
||||
let g:lua_tree_ignore = [ '.git', 'node_modules', '.cache' ] "empty by default, not working on mac atm
|
||||
let g:lua_tree_auto_open = 1 "0 by default, opens the tree when typing `vim $DIR` or `vim`
|
||||
let g:lua_tree_auto_close = 1 "0 by default, closes the tree when it's the last window
|
||||
let g:lua_tree_show_folders = 0 "1 by default, do not show folder icons if you font doesn't render them
|
||||
let g:lua_tree_show_git_icons = 0 "1 by default, do not show git icons if you font doesn't render them
|
||||
let g:lua_tree_follow = 1 "0 by default, this option will bind BufEnter to the LuaTreeFindFile command
|
||||
" :help LuaTreeFindFile for more info
|
||||
|
||||
|
||||
@ -52,7 +52,16 @@ An array of strings that the tree won't display.
|
||||
Each pattern is passed into the 'ls' function as `--ignore=PATTERN`
|
||||
>
|
||||
example: let g:lua_tree_ignore = [ '.git', 'node_modules' ]
|
||||
<
|
||||
|
||||
|g:lua_tree_show_folders| *g:lua_tree_show_folders*
|
||||
|
||||
Can be `0` or `1`. When `0` it will not show the folder icons
|
||||
Default is 1
|
||||
|
||||
|g:lua_tree_show_git_icons| *g:lua_tree_show_git_icons*
|
||||
|
||||
Can be `0` or `1`. When `0` it will not show git icons.
|
||||
Default is 1
|
||||
|
||||
|g:lua_tree_follow| *g:lua_tree_follow*
|
||||
|
||||
|
||||
4
doc/tags
4
doc/tags
@ -1,10 +1,12 @@
|
||||
:LuaTreeFindFile nvim-tree-lua.txt /*:LuaTreeFindFile*
|
||||
:LuaTreeRefresh nvim-tree-lua.txt /*:LuaTreeRefresh*
|
||||
:LuaTreeToggle nvim-tree-lua.txt /*:LuaTreeToggle*
|
||||
g:lua_tree_auto_open nvim-tree-lua.txt /*g:lua_tree_auto_open*
|
||||
g:lua_tree_auto_close nvim-tree-lua.txt /*g:lua_tree_auto_close*
|
||||
g:lua_tree_auto_open nvim-tree-lua.txt /*g:lua_tree_auto_open*
|
||||
g:lua_tree_follow nvim-tree-lua.txt /*g:lua_tree_follow*
|
||||
g:lua_tree_ignore nvim-tree-lua.txt /*g:lua_tree_ignore*
|
||||
g:lua_tree_show_folders nvim-tree-lua.txt /*g:lua_tree_show_folders*
|
||||
g:lua_tree_show_git_icons nvim-tree-lua.txt /*g:lua_tree_show_git_icons*
|
||||
g:lua_tree_side nvim-tree-lua.txt /*g:lua_tree_side*
|
||||
g:lua_tree_size nvim-tree-lua.txt /*g:lua_tree_size*
|
||||
nvim-tree-commands nvim-tree-lua.txt /*nvim-tree-commands*
|
||||
|
||||
@ -2,6 +2,16 @@ local api = vim.api
|
||||
|
||||
local HAS_DEV_ICONS = api.nvim_call_function('exists', { "*WebDevIconsGetFileTypeSymbol" }) == 1
|
||||
|
||||
local function get(var, fallback)
|
||||
if api.nvim_call_function('exists', { 'g:'..var }) == 1 then
|
||||
return api.nvim_get_var(var)
|
||||
else
|
||||
return fallback
|
||||
end
|
||||
end
|
||||
|
||||
local SHOW_FOLDER_ICON = get('lua_tree_show_folders', 1) == 1
|
||||
|
||||
local function get_padding(depth)
|
||||
local str = ""
|
||||
|
||||
@ -14,7 +24,7 @@ local function get_padding(depth)
|
||||
end
|
||||
|
||||
local function default_icons(_, isdir, open)
|
||||
if isdir == true then
|
||||
if isdir == true and SHOW_FOLDER_ICON then
|
||||
if open == true then return " " end
|
||||
return " "
|
||||
end
|
||||
@ -122,8 +132,10 @@ local function highlight_line(buffer)
|
||||
highlight('LuaTreeFolderName', line, 0, -1)
|
||||
|
||||
elseif node.dir == true then
|
||||
text_start = text_start + 4
|
||||
highlight('LuaTreeFolderIcon', line, 0, text_start)
|
||||
if SHOW_FOLDER_ICON then
|
||||
text_start = text_start + 4
|
||||
highlight('LuaTreeFolderIcon', line, 0, text_start)
|
||||
end
|
||||
highlight('LuaTreeFolderName', line, text_start + gitlen, -1)
|
||||
|
||||
elseif node.link == true then
|
||||
|
||||
@ -51,8 +51,18 @@ local unmerged = create_git_checker('^[U ][U ]')
|
||||
local renamed = create_git_checker('^R')
|
||||
local untracked = create_git_checker('^%?%?')
|
||||
|
||||
local function get(var, fallback)
|
||||
if vim.api.nvim_call_function('exists', { 'g:'..var }) == 1 then
|
||||
return vim.api.nvim_get_var(var)
|
||||
else
|
||||
return fallback
|
||||
end
|
||||
end
|
||||
|
||||
local SHOW_GIT_ICON = get('lua_tree_show_git_icons', 1) == 1
|
||||
|
||||
local function get_git_attr(path, is_dir)
|
||||
if IS_GIT_REPO == false then return '' end
|
||||
if IS_GIT_REPO == false or not SHOW_GIT_ICON then return '' end
|
||||
if is_dir then
|
||||
if is_folder_dirty(path) == true then return '✗ ' end
|
||||
else
|
||||
|
||||
Loading…
Reference in New Issue
Block a user