Skip to content

feat(#2415): add :NvimTreeHiTest #2664

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 33 additions & 2 deletions doc/nvim-tree-lua.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ CONTENTS *nvim-tree*
2.1 Quickstart: Setup |nvim-tree-quickstart-setup|
2.2 Quickstart: Help |nvim-tree-quickstart-help|
2.3 Quickstart: Custom Mappings |nvim-tree-quickstart-custom-mappings|
2.4 Quickstart: Highlight |nvim-tree-quickstart-highlight|
3. Commands |nvim-tree-commands|
4. Setup |nvim-tree-setup|
5. Opts |nvim-tree-opts|
Expand Down Expand Up @@ -43,6 +44,7 @@ CONTENTS *nvim-tree*
6.7 API Marks |nvim-tree-api.marks|
6.8 API Config |nvim-tree-api.config|
6.9 API Commands |nvim-tree-api.commands|
6.10 API Appearance |nvim-tree-api.appearance|
7. Mappings |nvim-tree-mappings|
7.1 Mappings: Default |nvim-tree-mappings-default|
8. Highlight |nvim-tree-highlight|
Expand Down Expand Up @@ -229,6 +231,16 @@ via |nvim-tree.on_attach| e.g. >
---
}
<
==============================================================================
2.4 QUICKSTART: HIGHLIGHT *nvim-tree-quickstart-highlight*

Run |:NvimTreeHiTest| to show all the highlights that nvim-tree uses.

They can be customised before or after setup is called and will be immediately
applied at runtime.

See |nvim-tree-highlight| for details.

==============================================================================
3. COMMANDS *nvim-tree-commands*

Expand Down Expand Up @@ -323,6 +335,14 @@ via |nvim-tree.on_attach| e.g. >

Calls: `api.tree.collapse_all(true)`

*:NvimTreeHiTest*

Show nvim-tree highlight groups similar to `:so $VIMRUNTIME/syntax/hitest.vim`

See |nvim-tree-api.appearance.hi_test()|

Calls: `api.appearance.hi_test()`

==============================================================================
4. SETUP *nvim-tree-setup*

Expand Down Expand Up @@ -2070,7 +2090,7 @@ config.mappings.get_keymap_default()
(table) as per |nvim_buf_get_keymap()|

==============================================================================
6.8 API COMMANDS *nvim-tree-api.commands*
6.9 API COMMANDS *nvim-tree-api.commands*

commands.get() *nvim-tree-api.commands.get()*
Retrieve all commands, see |nvim-tree-commands|
Expand All @@ -2081,6 +2101,15 @@ commands.get() *nvim-tree-api.commands.get()*
• {command} (function)
• {opts} (table)

==============================================================================
6.10 APPEARANCE *nvim-tree-api.appearance*

appearance.hi_test() *nvim-tree-api.appearance.hi_test()*
Open a new buffer displaying all nvim-tree highlight groups, their link
chain and concrete definition.

Similar to `:so $VIMRUNTIME/syntax/hitest.vim` as per |:highlight|

==============================================================================
7. MAPPINGS *nvim-tree-mappings*

Expand Down Expand Up @@ -2245,7 +2274,9 @@ Example |:highlight| >
It is recommended to enable 'termguicolors' for the more pleasant 24-bit
colours.

To view the active highlight groups run `:so $VIMRUNTIME/syntax/hitest.vim`
To view the nvim-tree highlight groups run |:NvimTreeHiTest|

To view all active highlight groups run `:so $VIMRUNTIME/syntax/hitest.vim`
as per |:highlight|

The `*HL` groups are additive as per |nvim-tree-opts-renderer| precedence.
Expand Down
4 changes: 4 additions & 0 deletions lua/nvim-tree/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ local lib = require "nvim-tree.lib"
local view = require "nvim-tree.view"
local utils = require "nvim-tree.utils"
local actions = require "nvim-tree.actions"
local appearance = require "nvim-tree.appearance"
local events = require "nvim-tree.events"
local help = require "nvim-tree.help"
local live_filter = require "nvim-tree.live-filter"
Expand Down Expand Up @@ -38,6 +39,7 @@ local Api = {
config = {
mappings = {},
},
appearance = {},
commands = {},
}

Expand Down Expand Up @@ -244,6 +246,8 @@ Api.config.mappings.get_keymap = wrap(keymap.get_keymap)
Api.config.mappings.get_keymap_default = wrap(keymap.get_keymap_default)
Api.config.mappings.default_on_attach = keymap.default_on_attach

Api.appearance.hi_test = wrap(appearance.hi_test)

Api.commands.get = wrap(function()
return require("nvim-tree.commands").get()
end)
Expand Down
Loading