@@ -117,7 +117,7 @@ Disabling |netrw| is strongly advised, see |nvim-tree-netrw|
117
117
==============================================================================
118
118
2.1 QUICKSTART: SETUP *nvim-tree-quickstart-setup*
119
119
120
- Setup the plugin in your `init.lua ` >
120
+ Setup the plugin in your `init.lua ` e.g. >lua
121
121
122
122
-- disable netrw at the very start of your init.lua
123
123
vim.g.loaded_netrw = 1
@@ -215,7 +215,7 @@ Show the mappings: `g?`
215
215
2.3 QUICKSTART: CUSTOM MAPPINGS *nvim-tree-quickstart-custom-mappings*
216
216
217
217
| nvim-tree-mappings-default | are applied by default however you may customise
218
- via | nvim-tree.on_attach | e.g. >
218
+ via | nvim-tree.on_attach | e.g. >lua
219
219
220
220
local function my_on_attach(bufnr)
221
221
local api = require "nvim-tree.api"
@@ -245,7 +245,7 @@ via |nvim-tree.on_attach| e.g. >
245
245
Run | :NvimTreeHiTest | to show all the highlights that nvim-tree uses.
246
246
247
247
They can be customised before or after setup is called and will be immediately
248
- applied at runtime. e.g. >
248
+ applied at runtime. e.g. >lua
249
249
250
250
vim.cmd([[
251
251
:hi NvimTreeExecFile guifg=#ffa0a0
@@ -366,15 +366,15 @@ again to apply a change in configuration without restarting nvim.
366
366
367
367
setup() function takes one optional argument: configuration table. If omitted
368
368
nvim-tree will be initialised with default configuration.
369
- >
369
+
370
370
The first setup() call is cheap: it does nothing more than validate / apply
371
371
the configuration. Nothing happens until the tree is first opened.
372
372
373
373
Subsequent setup() calls are expensive as they tear down the world before
374
374
applying configuration.
375
375
376
- Following is the default configuration. See | nvim-tree-opts | for details.
377
- >
376
+ Following is the default configuration. See | nvim-tree-opts | for details. >lua
377
+
378
378
require("nvim-tree").setup { -- BEGIN_DEFAULT_OPTS
379
379
on_attach = "default",
380
380
hijack_cursor = false,
@@ -677,7 +677,7 @@ Completely disable netrw
677
677
678
678
It is strongly advised to eagerly disable netrw, due to race conditions at vim
679
679
startup.
680
- Set the following at the very beginning of your `init.lua ` / `init.vim ` : >
680
+ Set the following at the very beginning of your `init.lua ` / `init.vim ` : >lua
681
681
vim.g.loaded_netrw = 1
682
682
vim.g.loaded_netrwPlugin = 1
683
683
<
@@ -739,7 +739,7 @@ Can be one of `"name"`, `"case_sensitive"`, `"modification_time"`, `"extension"`
739
739
- `name` : `string `
740
740
- `type ` : `" directory" ` | `" file" ` | `" link" `
741
741
742
- Example: sort by name length: >
742
+ Example: sort by name length: >lua
743
743
local sorter = function(nodes)
744
744
table.sort(nodes, function(a, b)
745
745
return #a.name < #b.name
@@ -871,7 +871,7 @@ Set to `false` to hide the root folder.
871
871
Type: `string ` or `boolean ` or `function (root_cwd)` , Default: `" :~:s?$?/..?" `
872
872
873
873
Function is passed the absolute path of the root folder and should
874
- return a string. e.g. >
874
+ return a string. e.g. >lua
875
875
my_root_folder_label = function(path)
876
876
return ".../" .. vim.fn.fnamemodify(path, ":t")
877
877
end
@@ -903,7 +903,7 @@ Show a summary of hidden files below the tree using `NvimTreeHiddenDisplay
903
903
reasons and values are the count of hidden files for that reason.
904
904
905
905
The `hidden_stats` argument is structured as follows, where <num> is the
906
- number of hidden files related to the field: >
906
+ number of hidden files related to the field: >lua
907
907
hidden_stats = {
908
908
bookmark = <num> ,
909
909
buf = <num> ,
@@ -913,7 +913,7 @@ Show a summary of hidden files below the tree using `NvimTreeHiddenDisplay
913
913
live_filter = <num> ,
914
914
}
915
915
<
916
- Example of function that can be passed: >
916
+ Example of function that can be passed: >lua
917
917
function(hidden_stats)
918
918
local total_count = 0
919
919
for reason, count in pairs(hidden_stats) do
@@ -988,7 +988,7 @@ Configuration options for tree indent markers.
988
988
989
989
*nvim-tree.renderer.indent_markers.icons*
990
990
Icons shown before the file/directory. Length 1.
991
- Type: `table` , Default: >
991
+ Type: `table` , Default: >lua
992
992
{
993
993
corner = "└",
994
994
edge = "│",
@@ -1300,7 +1300,7 @@ Severity for which the diagnostics will be displayed. See |diagnostic-severity|
1300
1300
1301
1301
*nvim-tree.diagnostics.icons*
1302
1302
Icons for diagnostic severity.
1303
- Type: `table` , Default: >
1303
+ Type: `table` , Default: >lua
1304
1304
{
1305
1305
hint = "",
1306
1306
info = "",
@@ -1421,7 +1421,7 @@ function returning whether a path should be ignored.
1421
1421
Strings must be backslash escaped e.g. `" my-proj/\\ .build$" ` . See | string-match | .
1422
1422
Function is passed an absolute path.
1423
1423
Useful when path is not in `.gitignore` or git integration is disabled.
1424
- Type: `string[] | fun(path: string): boolean`, Default: >
1424
+ Type: `string[] | fun(path: string): boolean`, Default: >lua
1425
1425
{
1426
1426
"/.ccls-cache",
1427
1427
"/build",
@@ -1513,7 +1513,7 @@ Configuration options for opening a file from nvim-tree.
1513
1513
or `nil` if an invalid window is picked or user cancelled the action.
1514
1514
The picker may create a new window.
1515
1515
Type: `string ` | `function ` , Default: `" default" `
1516
- e.g. s1n7ax/nvim-window-picker plugin: >
1516
+ e.g. s1n7ax/nvim-window-picker plugin: >lua
1517
1517
window_picker = {
1518
1518
enable = true,
1519
1519
picker = require("window-picker").pick_window,
@@ -1526,7 +1526,7 @@ Configuration options for opening a file from nvim-tree.
1526
1526
Table of buffer option names mapped to a list of option values that
1527
1527
indicates to the picker that the buffer's window should not be
1528
1528
selectable.
1529
- Type: `table` , Default: >
1529
+ Type: `table` , Default: >lua
1530
1530
{
1531
1531
filetype = {
1532
1532
"notify",
@@ -1685,9 +1685,7 @@ Specify which information to log.
1685
1685
==============================================================================
1686
1686
6. API *nvim-tree-api*
1687
1687
1688
- Nvim-tree's public API can be used to access features.
1689
- >
1690
- e.g. >
1688
+ Nvim-tree's public API can be used to access features. e.g. >lua
1691
1689
local api = require("nvim-tree.api")
1692
1690
api.tree.toggle()
1693
1691
<
@@ -2286,7 +2284,7 @@ Active mappings may be viewed via HELP, default `g?`. The mapping's description
2286
2284
is used when displaying HELP.
2287
2285
2288
2286
The `on_attach` function is passed the `bufnr ` of nvim-tree. Use
2289
- | vim.keymap.set() | or | nvim_set_keymap() | to define mappings as usual. e.g. >
2287
+ | vim.keymap.set() | or | nvim_set_keymap() | to define mappings as usual. e.g. >lua
2290
2288
2291
2289
local function my_on_attach(bufnr)
2292
2290
local api = require("nvim-tree.api")
@@ -2326,7 +2324,7 @@ Single left mouse mappings can be achieved via `<LeftRelease>`.
2326
2324
Single right / middle mouse mappings will require changes to | mousemodel | or | mouse | .
2327
2325
2328
2326
| vim.keymap.set() | {rhs} is a `(function |string )` thus it may be necessary to
2329
- define your own function to map complex functionality e.g. >
2327
+ define your own function to map complex functionality e.g. >lua
2330
2328
2331
2329
local function print_node_path()
2332
2330
local api = require("nvim-tree.api")
@@ -2343,8 +2341,8 @@ define your own function to map complex functionality e.g. >
2343
2341
In the absence of an | nvim-tree.on_attach | function, the following defaults
2344
2342
will be applied.
2345
2343
2346
- You are encouraged to copy these to your own | nvim-tree.on_attach | function.
2347
- >
2344
+ You are encouraged to copy these to your own | nvim-tree.on_attach | function. >lua
2345
+
2348
2346
local api = require("nvim-tree.api")
2349
2347
2350
2348
local function opts(desc)
@@ -2413,8 +2411,8 @@ You are encouraged to copy these to your own |nvim-tree.on_attach| function.
2413
2411
-- END_DEFAULT_ON_ATTACH
2414
2412
<
2415
2413
Alternatively, you may apply these default mappings from your | nvim-tree.on_attach | via
2416
- | nvim-tree-api.config.mappings.default_on_attach() | e.g.
2417
- >
2414
+ | nvim-tree-api.config.mappings.default_on_attach() | e.g. >lua
2415
+
2418
2416
local function my_on_attach(bufnr)
2419
2417
local api = require("nvim-tree.api")
2420
2418
@@ -2434,10 +2432,10 @@ All the following highlight groups can be configured by hand. Aside from
2434
2432
`NvimTreeWindowPicker` , it is not advised to colorize the background of these
2435
2433
groups.
2436
2434
2437
- Example | :highlight | >
2435
+ Example | :highlight | >vim
2438
2436
:hi NvimTreeSymlink guifg=blue gui=bold,underline
2439
2437
<
2440
- It is recommended to enable ' termguicolors' for the more pleasant 24-bit
2438
+ It is recommended to enable | termguicolors | for the more pleasant 24-bit
2441
2439
colours.
2442
2440
2443
2441
To view the nvim-tree highlight groups run | :NvimTreeHiTest |
@@ -2448,16 +2446,18 @@ as per |:highlight|
2448
2446
The `* HL` groups are additive as per | nvim-tree-opts-renderer | precedence.
2449
2447
Only present attributes will clobber each other.
2450
2448
In this example a modified, opened file will have magenta text, with cyan
2451
- undercurl: >
2449
+ undercurl: >vim
2452
2450
:hi NvimTreeOpenedHL guifg=magenta guisp=red gui=underline
2453
2451
:hi NvimTreeModifiedFileHL guisp=cyan gui=undercurl
2454
2452
<
2455
2453
To prevent usage of a highlight:
2456
- - Before setup: link the group to `Normal ` e.g.
2457
- `:hi NvimTreeExecFile Normal`
2458
- - After setup: link it to `NONE ` , to override the default link e.g.
2459
- `:hi! link NvimTreeExecFile NONE`
2460
2454
2455
+ - Before setup: link the group to `Normal ` e.g. >vim
2456
+ :hi NvimTreeExecFile Normal
2457
+ <
2458
+ - After setup: link it to `NONE ` , to override the default link e.g. >lua
2459
+ :hi! link NvimTreeExecFile NONE
2460
+ <
2461
2461
==============================================================================
2462
2462
8.1 HIGHLIGHT: DEFAULT *nvim-tree-highlight-default*
2463
2463
@@ -2612,7 +2612,7 @@ See |nvim-tree-legacy-highlight| for old highlight group compatibility.
2612
2612
- NvimTreeSpecialFile PreProc -> SpellCap
2613
2613
- NvimTreeSymlink Statement -> SpellCap
2614
2614
2615
- Approximate pre-overhaul values for the `SpellCap ` groups may be set via: >
2615
+ Approximate pre-overhaul values for the `SpellCap ` groups may be set via: >lua
2616
2616
2617
2617
vim.cmd([[
2618
2618
:hi NvimTreeExecFile gui=bold guifg=#ffa0a0
@@ -2639,7 +2639,8 @@ to |nvim_tree_registering_handlers| for more information.
2639
2639
Handlers are registered by calling | nvim-tree-api.events.subscribe() |
2640
2640
function with an | nvim-tree-api.events.Event |
2641
2641
2642
- e.g. handler for node renamed: >
2642
+ e.g. handler for node renamed: >lua
2643
+
2643
2644
local api = require("nvim-tree.api")
2644
2645
local Event = api.events.Event
2645
2646
@@ -2726,7 +2727,8 @@ There are two special startup events in the form of User autocommands:
2726
2727
Immediately before firing: a global variable of the same name will be set to a
2727
2728
value of 1.
2728
2729
2729
- Example subscription: >
2730
+ Example subscription: >lua
2731
+
2730
2732
vim.api.nvim_create_autocmd("User", {
2731
2733
pattern = "NvimTreeRequired",
2732
2734
callback = function(data)
@@ -2778,7 +2780,7 @@ It interferes with nvim-tree and the intended user experience is nvim-tree
2778
2780
replacing the | netrw | browser.
2779
2781
2780
2782
It is strongly recommended to disable | netrw | . As it is a bundled plugin it
2781
- must be disabled manually at the start of your `init.lua ` as per | netrw-noload | : >
2783
+ must be disabled manually at the start of your `init.lua ` as per | netrw-noload | : >lua
2782
2784
2783
2785
vim.g.loaded_netrw = 1
2784
2786
vim.g.loaded_netrwPlugin = 1
0 commit comments