Skip to content

Commit c003626

Browse files
committed
make linking of default groups for tree style and add docs
1 parent 658e210 commit c003626

File tree

7 files changed

+26
-8
lines changed

7 files changed

+26
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ nnoremap <leader>n :LuaTreeFindFile<CR>
3939
" example configuration:
4040
set termguicolors " this variable must be enabled for colors to be applied properly
4141
42+
" a list of groups can be found in `:help lua_tree_highlight`
4243
highlight LuaTreeFolderName guibg=cyan gui=bold,underline
4344
highlight LuaTreeFolderIcon guibg=blue
44-
" ...
4545
```
4646

4747
## KeyBindings

doc/nvim-tree-lua.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ Mouse support defined in |KeyBindings|
134134
==============================================================================
135135
HIGHLIGHT GROUPS *nvim-tree-highlight*
136136

137+
|lua_tree_highlight| *lua_tree_highlight*
138+
137139
All the following highlight groups can be configured by hand. It is not
138140
advised to colorize the background of these groups.
139141

@@ -175,5 +177,13 @@ LuaTreeGitMerge
175177
LuaTreeGitRenamed
176178
LuaTreeGitNew
177179

180+
There are also links to normal bindings to style the tree itself.
181+
182+
Normal
183+
EndOfBuffer
184+
CursorLine
185+
VertSplit
186+
CursorColumn
187+
178188
vim:tw=78:ts=8:noet:ft=help:norl:
179189

doc/tags

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ g:lua_tree_ignore nvim-tree-lua.txt /*g:lua_tree_ignore*
88
g:lua_tree_show_icons nvim-tree-lua.txt /*g:lua_tree_show_icons*
99
g:lua_tree_side nvim-tree-lua.txt /*g:lua_tree_side*
1010
g:lua_tree_size nvim-tree-lua.txt /*g:lua_tree_size*
11+
lua_tree_highlight nvim-tree-lua.txt /*lua_tree_highlight*
1112
nvim-tree-commands nvim-tree-lua.txt /*nvim-tree-commands*
1213
nvim-tree-features nvim-tree-lua.txt /*nvim-tree-features*
1314
nvim-tree-highlight nvim-tree-lua.txt /*nvim-tree-highlight*

lua/lib/colors.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,26 @@ local HIGHLIGHTS = {
3232
GitStaged = { fg = colors.green },
3333
GitMerge = { fg = colors.orange },
3434
GitRenamed = { fg = colors.purple },
35-
GitNew = { fg = colors.yellow },
35+
GitNew = { fg = colors.yellow }
36+
}
3637

37-
EndOfBuffer = { fg = 'bg' }
38+
local LINKS = {
39+
Normal = 'Normal',
40+
EndOfBuffer = 'EndOfBuffer',
41+
CursorLine = 'CursorLine',
42+
VertSplit = 'VertSplit',
43+
CursorColumn = 'CursorColumn'
3844
}
3945

4046
local function init_colors()
4147
for k, d in pairs(HIGHLIGHTS) do
4248
local gui = d.gui or 'NONE'
4349
vim.api.nvim_command('hi def LuaTree'..k..' gui='..gui..' guifg='..d.fg)
4450
end
51+
52+
for k, d in pairs(LINKS) do
53+
vim.api.nvim_command('hi def link LuaTree'..k..' '..d)
54+
end
4555
end
4656

4757
return {

lua/lib/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ local colors = {
2626
orange = get('terminal_color_11', 'Orange'),
2727
dark_red = get('terminal_color_9', 'DarkRed'),
2828
}
29+
2930
return {
3031
SHOW_FOLDER_ICON = SHOW_FOLDER_ICON,
3132
SHOW_FILE_ICON = SHOW_FILE_ICON,

lua/lib/winutils.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ local function open()
7171
api.nvim_command('vertical resize '..WIN_WIDTH)
7272
api.nvim_win_set_buf(0, buf)
7373

74-
api.nvim_command('setlocal winhighlight=EndOfBuffer:LuaTreeEndOfBuffer')
74+
api.nvim_command('setlocal winhighlight=EndOfBuffer:LuaTreeEndOfBuffer,Normal:LuaTreeNormal,CursorLine:LuaTreeCursorLine,VertSplit:LuaTreeVertSplit')
7575
for _, opt in pairs(BUF_OPTIONS) do
7676
api.nvim_command('setlocal '..opt)
7777
end

plugin/tree.vim

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ if get(g:, 'lua_tree_auto_open') != 0
1818
au VimEnter * lua require'tree'.check_buffer_and_open()
1919
endif
2020

21-
" TODO set status line dynamically on bufenter in the luatree
22-
" to remove lightline and other possible components
23-
au BufEnter LuaTree setlocal statusline=""
24-
2521
if get(g:, 'lua_tree_follow') != 0
2622
au BufEnter * :LuaTreeFindFile
2723
endif

0 commit comments

Comments
 (0)