@@ -64,7 +64,7 @@ Requirements
64
64
==============================================================================
65
65
2. QUICK START *nvim-tree-quickstart*
66
66
67
- Setup should be run in a lua file or in a | lua-heredoc | if using in a vim file.
67
+ Setup should be run in a lua file or in a | lua-heredoc | if using in a vim file. >lua
68
68
69
69
-- examples for your init.lua
70
70
@@ -169,7 +169,7 @@ setup() function takes one optional argument: configuration table. If omitted
169
169
nvim-tree will be initialised with default configuration.
170
170
171
171
Subsequent calls to setup will replace the previous configuration.
172
- >
172
+ >lua
173
173
require("nvim-tree").setup { -- BEGIN_DEFAULT_OPTS
174
174
auto_reload_on_write = true,
175
175
disable_netrw = false,
@@ -394,6 +394,12 @@ Subsequent calls to setup will replace the previous configuration.
394
394
watcher = false,
395
395
},
396
396
},
397
+ experimental = {
398
+ async = {
399
+ create_file = false,
400
+ rename_file = false,
401
+ }
402
+ }
397
403
} -- END_DEFAULT_OPTS
398
404
<
399
405
@@ -405,7 +411,7 @@ Completely disable netrw
405
411
406
412
It is strongly advised to eagerly disable netrw, due to race conditions at vim
407
413
startup.
408
- Set the following at the very beginning of your `init.lua ` / `init.vim ` : >
414
+ Set the following at the very beginning of your `init.lua ` / `init.vim ` : >lua
409
415
vim.g.loaded_netrw = 1
410
416
vim.g.loaded_netrwPlugin = 1
411
417
<
@@ -452,7 +458,7 @@ function.
452
458
- `name` : `string `
453
459
- `type ` : `" directory" ` | `" file" ` | `" link" `
454
460
455
- Example: sort by name length: >
461
+ Example: sort by name length: >lua
456
462
local sort_by = function(nodes)
457
463
table.sort(nodes, function(a, b)
458
464
return #a.name < #b.name
@@ -646,7 +652,7 @@ This can be used to attach keybindings to the tree buffer.
646
652
When on_attach is "disabled", it will use the older mapping strategy, otherwise it
647
653
will use the newer one.
648
654
Type: `function (bufnr )` , Default: `" disable" `
649
- e.g. >
655
+ e.g. >lua
650
656
local api = require("nvim-tree.api")
651
657
652
658
local function on_attach(bufnr)
@@ -780,7 +786,7 @@ UI rendering setup
780
786
Type: `string ` or `function (root_cwd)` , Default: `" :~:s?$?/..?" `
781
787
782
788
Function is passed the absolute path of the root folder and should return a string.
783
- e.g. >
789
+ e.g. >lua
784
790
my_root_folder_label = function(path)
785
791
return ".../" .. vim.fn.fnamemodify(path, ":t")
786
792
end
@@ -1012,7 +1018,7 @@ Configuration for various actions.
1012
1018
The function should return the window id that will open the node,
1013
1019
or `nil` if an invalid window is picked or user cancelled the action.
1014
1020
Type: `string ` | `function ` , Default: `" default" `
1015
- e.g. s1n7ax/nvim-window-picker plugin: >
1021
+ e.g. s1n7ax/nvim-window-picker plugin: >lua
1016
1022
window_picker = {
1017
1023
enable = true,
1018
1024
picker = require('window-picker').pick_window,
@@ -1134,6 +1140,21 @@ Configuration for diagnostic logging.
1134
1140
| nvim-tree.filesystem_watchers | processing, verbose.
1135
1141
Type: `boolean ` , Default: `false`
1136
1142
1143
+ *nvim-tree.experimental*
1144
+ Configuration for experimental features.
1145
+
1146
+ *nvim-tree.experimental.async*
1147
+ Control experimental async behavior.
1148
+
1149
+ *nvim-tree.experimental.async.create_file*
1150
+ Toggle async behavior of create file operation.
1151
+ Type: `boolean ` , Default: `false`
1152
+
1153
+ *nvim-tree.experimental.async.rename_file*
1154
+ Toggle async behavior of rename file operation. Note this also
1155
+ influence bulk move action.
1156
+ Type: `boolean ` , Default: `false`
1157
+
1137
1158
==============================================================================
1138
1159
4.1 VINEGAR STYLE *nvim-tree-vinegar*
1139
1160
@@ -1144,8 +1165,8 @@ it in a specific way:
1144
1165
1145
1166
- Use `require" nvim-tree" .open_replacing_current_buffer ()` instead of the
1146
1167
default open command.
1147
- You can easily implement a toggle using this too:
1148
- >
1168
+ You can easily implement a toggle using this too: >lua
1169
+
1149
1170
local function toggle_replace()
1150
1171
local view = require"nvim-tree.view"
1151
1172
local api = require"nvim-tree.api"
@@ -1157,8 +1178,8 @@ You can easily implement a toggle using this too:
1157
1178
end
1158
1179
<
1159
1180
- Use the `edit_in_place` action to edit files. It's bound to `<C-e> ` by
1160
- default, vinegar uses `<CR> ` . You can override this with:
1161
- >
1181
+ default, vinegar uses `<CR> ` . You can override this with: >lua
1182
+
1162
1183
require"nvim-tree".setup {
1163
1184
view = {
1164
1185
mappings = {
@@ -1179,8 +1200,8 @@ A good functionality to enable is |nvim-tree.hijack_directories|.
1179
1200
5. API *nvim-tree-api*
1180
1201
1181
1202
Nvim-tree's public API can be used to access features.
1182
- >
1183
- e.g. >
1203
+
1204
+ e.g. >lua
1184
1205
local api = require("nvim-tree.api")
1185
1206
api.tree.toggle()
1186
1207
<
@@ -1262,6 +1283,10 @@ exists.
1262
1283
- api.events: *nvim-tree.api.events*
1263
1284
- subscribe `(eventType: Event, callback: function(...args))`
1264
1285
- Event (enum type, please see | nvim_tree_events_kind | )
1286
+ - subscribe_async `(eventType: Event, callback: function(...args))`
1287
+ Same as `subscribe` , except the callback could be async. The async
1288
+ callback will be called in the same context as the event. See also
1289
+ *nvim-tree.api.async*.
1265
1290
1266
1291
- api.live_filter: *nvim-tree.api.live_filter*
1267
1292
- start
@@ -1277,6 +1302,10 @@ exists.
1277
1302
- navigate.prev
1278
1303
- navigate.select
1279
1304
1305
+ - api.async: *nvim-tree.api.async*
1306
+ - call `(func: function, ...args)`
1307
+ - in_async
1308
+
1280
1309
==============================================================================
1281
1310
6. MAPPINGS *nvim-tree-mappings*
1282
1311
@@ -1300,7 +1329,7 @@ Setting your own mapping in the configuration will soon be deprecated, see
1300
1329
Default `' n' ` .
1301
1330
1302
1331
Examples:
1303
- >
1332
+ >lua
1304
1333
local function print_node_path(node)
1305
1334
print(node.absolute_path)
1306
1335
end
@@ -1382,7 +1411,7 @@ DEFAULT MAPPINGS *nvim-tree-default-mappings
1382
1411
`m ` toggle_mark Toggle node in bookmarks
1383
1412
`bmv` bulk_move Move all bookmarked nodes into specified location
1384
1413
1385
- >
1414
+ >lua
1386
1415
view.mappings.list = { -- BEGIN_DEFAULT_MAPPINGS
1387
1416
{ key = { "<CR> ", "o", "<2-LeftMouse> " }, action = "edit" },
1388
1417
{ key = "<C-e> ", action = "edit_in_place" },
@@ -1444,7 +1473,7 @@ All the following highlight groups can be configured by hand. Aside from
1444
1473
groups.
1445
1474
1446
1475
Example (in your `init.vim ` ):
1447
- >
1476
+ >vim
1448
1477
highlight NvimTreeSymlink guifg=blue gui=bold,underline
1449
1478
<
1450
1479
You should have 'termguicolors' enabled, otherwise, colors will not be
@@ -1534,7 +1563,7 @@ to |nvim_tree_registering_handlers| for more information.
1534
1563
Handlers are registered by calling | nvim-tree-api | `events.subscribe`
1535
1564
function with an `events.Event` kind.
1536
1565
1537
- e.g. handler for node renamed: >
1566
+ e.g. handler for node renamed: >lua
1538
1567
local api = require("nvim-tree.api")
1539
1568
local Event = api.events.Event
1540
1569
@@ -1595,12 +1624,12 @@ To get the list of marked paths, you can call
1595
1624
Navigation for marks is not bound by default in nvim-tree because we don't
1596
1625
want to focus the tree view each time we wish to switch to another mark.
1597
1626
1598
- This requires binding bookmark navigation yourself.
1599
-
1600
- -- in your lua configuration
1601
- vim.keymap.set("n", "<leader> mn ", require("nvim-tree.api").marks.navigate.next )
1602
- vim.keymap.set("n", "<leader> mp ", require("nvim-tree.api").marks.navigate.prev )
1603
- vim.keymap.set("n", " <leader> ms", require("nvim-tree.api").marks.navigate.select)
1627
+ This requires binding bookmark navigation yourself. >lua
1628
+ -- in your lua configuration
1629
+ vim.keymap.set("n", " <leader> mn", require("nvim-tree.api").marks.navigate.next)
1630
+ vim.keymap.set("n", "<leader> mp ", require("nvim-tree.api").marks.navigate.prev )
1631
+ vim.keymap.set("n", "<leader> ms ", require("nvim-tree.api").marks.navigate.select )
1632
+ <
1604
1633
1605
1634
==============================================================================
1606
1635
10. OS SPECIFIC RESTRICTIONS *nvim-tree-os-specific*
0 commit comments