add documentation for highlight groups
This commit is contained in:
parent
41b050a6ab
commit
658e2100eb
@ -34,6 +34,14 @@ let g:lua_tree_show_icons = {
|
||||
nnoremap <C-n> :LuaTreeToggle<CR>
|
||||
nnoremap <leader>r :LuaTreeRefresh<CR>
|
||||
nnoremap <leader>n :LuaTreeFindFile<CR>
|
||||
|
||||
" a list of highlight groups is available at :help nvim-tree-highlight
|
||||
" example configuration:
|
||||
set termguicolors " this variable must be enabled for colors to be applied properly
|
||||
|
||||
highlight LuaTreeFolderName guibg=cyan gui=bold,underline
|
||||
highlight LuaTreeFolderIcon guibg=blue
|
||||
" ...
|
||||
```
|
||||
|
||||
## KeyBindings
|
||||
@ -74,5 +82,4 @@ nnoremap <leader>n :LuaTreeFindFile<CR>
|
||||
|
||||
### Features
|
||||
- better default colors (use vim highlight groups)
|
||||
- create proper highlight groups or add highlight function to give the user ability to setup colors themselves
|
||||
- bufferize leafs of node being closed so when opening again the node, we open every directory that was previously open
|
||||
|
||||
@ -131,5 +131,49 @@ Git integration tells when a file is:
|
||||
|
||||
Mouse support defined in |KeyBindings|
|
||||
|
||||
==============================================================================
|
||||
HIGHLIGHT GROUPS *nvim-tree-highlight*
|
||||
|
||||
All the following highlight groups can be configured by hand. It is not
|
||||
advised to colorize the background of these groups.
|
||||
|
||||
Example (in your `init.vim`):
|
||||
>
|
||||
highlight LuaTreeSymlink guifg=blue gui=bold,underline
|
||||
<
|
||||
You should have 'termguicolors' enabled, otherwise, colors will not be
|
||||
applied.
|
||||
|
||||
LuaTreeSymlink
|
||||
LuaTreeFolderName
|
||||
LuaTreeFolderIcon
|
||||
LuaTreeExecFile
|
||||
LuaTreeSpecialFile
|
||||
LuaTreeImageFile
|
||||
LuaTreeMarkdownFile
|
||||
|
||||
LuaTreeLicenseIcon
|
||||
LuaTreeYamlIcon
|
||||
LuaTreeTomlIcon
|
||||
LuaTreeGitignoreIcon
|
||||
LuaTreeJsonIcon
|
||||
|
||||
LuaTreeLuaIcon
|
||||
LuaTreePythonIcon
|
||||
LuaTreeShellIcon
|
||||
LuaTreeJavascriptIcon
|
||||
LuaTreeCIcon
|
||||
LuaTreeReactIcon
|
||||
LuaTreeHtmlIcon
|
||||
LuaTreeRustIcon
|
||||
LuaTreeVimIcon
|
||||
LuaTreeTypescriptIcon
|
||||
|
||||
LuaTreeGitDirty
|
||||
LuaTreeGitStaged
|
||||
LuaTreeGitMerge
|
||||
LuaTreeGitRenamed
|
||||
LuaTreeGitNew
|
||||
|
||||
vim:tw=78:ts=8:noet:ft=help:norl:
|
||||
|
||||
|
||||
1
doc/tags
1
doc/tags
@ -10,6 +10,7 @@ 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*
|
||||
nvim-tree-features nvim-tree-lua.txt /*nvim-tree-features*
|
||||
nvim-tree-highlight nvim-tree-lua.txt /*nvim-tree-highlight*
|
||||
nvim-tree-info nvim-tree-lua.txt /*nvim-tree-info*
|
||||
nvim-tree-introduction nvim-tree-lua.txt /*nvim-tree-introduction*
|
||||
nvim-tree-keybindings nvim-tree-lua.txt /*nvim-tree-keybindings*
|
||||
|
||||
@ -11,22 +11,22 @@ local HIGHLIGHTS = {
|
||||
SpecialFile = { gui = 'bold,underline', fg = colors.yellow },
|
||||
ImageFile = { gui = 'bold', fg = colors.purple },
|
||||
MarkdownFile = { fg = colors.purple },
|
||||
LicenseFile = { fg = colors.yellow },
|
||||
YamlFile = { fg = colors.yellow },
|
||||
TomlFile = { fg = colors.yellow },
|
||||
GitignoreFile = { fg = colors.yellow },
|
||||
JsonFile = { fg = colors.yellow },
|
||||
LicenseIcon = { fg = colors.yellow },
|
||||
YamlIcon = { fg = colors.yellow },
|
||||
TomlIcon = { fg = colors.yellow },
|
||||
GitignoreIcon = { fg = colors.yellow },
|
||||
JsonIcon = { fg = colors.yellow },
|
||||
|
||||
LuaFile = { fg = '#42a5f5' },
|
||||
PythonFile = { fg = colors.green },
|
||||
ShellFile = { fg = colors.green },
|
||||
JavascriptFile = { fg = colors.yellow },
|
||||
CFile = { fg = colors.blue },
|
||||
ReactFile = { fg = colors.cyan },
|
||||
HtmlFile = { fg = colors.orange },
|
||||
RustFile = { fg = colors.orange },
|
||||
VimFile = { fg = colors.green },
|
||||
TypescriptFile = { fg = colors.blue },
|
||||
LuaIcon = { fg = '#42a5f5' },
|
||||
PythonIcon = { fg = colors.green },
|
||||
ShellIcon = { fg = colors.green },
|
||||
JavascriptIcon = { fg = colors.yellow },
|
||||
CIcon = { fg = colors.blue },
|
||||
ReactIcon = { fg = colors.cyan },
|
||||
HtmlIcon = { fg = colors.orange },
|
||||
RustIcon = { fg = colors.orange },
|
||||
VimIcon = { fg = colors.green },
|
||||
TypescriptIcon = { fg = colors.blue },
|
||||
|
||||
GitDirty = { fg = colors.dark_red },
|
||||
GitStaged = { fg = colors.green },
|
||||
|
||||
@ -87,28 +87,28 @@ local function format_tree(tree)
|
||||
return dirs
|
||||
end
|
||||
|
||||
local HIGHLIGHT_GROUPS = {
|
||||
['^LICENSE$'] = 'LicenseFile';
|
||||
['^%.?vimrc$'] = 'VimFile';
|
||||
['%.vim$'] = 'VimFile';
|
||||
['%.c$'] = 'CFile';
|
||||
['%.cpp$'] = 'CFile';
|
||||
['%.cxx$'] = 'CFile';
|
||||
['%.h$'] = 'CFile';
|
||||
['%.hpp$'] = 'CFile';
|
||||
['%.py$'] = 'PythonFile';
|
||||
['%.lua$'] = 'LuaFile';
|
||||
['%.rs$'] = 'RustFile';
|
||||
['%.[cz]?sh$'] = 'ShellFile';
|
||||
['%.md$'] = 'MarkdownFile';
|
||||
['%.json$'] = 'JsonFile';
|
||||
['%.toml$'] = 'TomlFile';
|
||||
['%.yml$'] = 'YamlFile';
|
||||
['%.gitignore$'] = 'GitignoreFile';
|
||||
['%.js$'] = 'JavascriptFile';
|
||||
['%.ts$'] = 'TypescriptFile';
|
||||
['%.[tj]sx$'] = 'ReactFile';
|
||||
['%.html?$'] = 'HtmlFile';
|
||||
local HIGHLIGHT_ICON_GROUPS = {
|
||||
['^LICENSE$'] = 'LicenseIcon';
|
||||
['^%.?vimrc$'] = 'VimIcon';
|
||||
['%.vim$'] = 'VimIcon';
|
||||
['%.c$'] = 'CIcon';
|
||||
['%.cpp$'] = 'CIcon';
|
||||
['%.cxx$'] = 'CIcon';
|
||||
['%.h$'] = 'CIcon';
|
||||
['%.hpp$'] = 'CIcon';
|
||||
['%.py$'] = 'PythonIcon';
|
||||
['%.lua$'] = 'LuaIcon';
|
||||
['%.rs$'] = 'RustIcon';
|
||||
['%.[cz]?sh$'] = 'ShellIcon';
|
||||
['%.md$'] = 'MarkdownIcon';
|
||||
['%.json$'] = 'JsonIcon';
|
||||
['%.toml$'] = 'TomlIcon';
|
||||
['%.yml$'] = 'YamlIcon';
|
||||
['%.gitignore$'] = 'GitignoreIcon';
|
||||
['%.js$'] = 'JavascriptIcon';
|
||||
['%.ts$'] = 'TypescriptIcon';
|
||||
['%.[tj]sx$'] = 'ReactIcon';
|
||||
['%.html?$'] = 'HtmlIcon';
|
||||
}
|
||||
|
||||
local function highlight_line(buffer)
|
||||
@ -141,7 +141,7 @@ local function highlight_line(buffer)
|
||||
highlight('LuaTreeImageFile', line, text_start + gitlen, -1)
|
||||
|
||||
elseif config.SHOW_FILE_ICON then
|
||||
for k, v in pairs(HIGHLIGHT_GROUPS) do
|
||||
for k, v in pairs(HIGHLIGHT_ICON_GROUPS) do
|
||||
if string.match(node.name, k) ~= nil then
|
||||
text_start = text_start + 4
|
||||
highlight('LuaTree' .. v, line, 0, text_start)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user