File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
-- This file should contain all commands meant to be used by mappings.
2
2
local cc = require (" neo-tree.sources.common.commands" )
3
+ local manager = require (" neo-tree.sources.manager" )
3
4
4
5
local vim = vim
5
6
@@ -13,6 +14,10 @@ M.example_command = function(state)
13
14
print (string.format (" example_command: id=%s, name=%s" , id , name ))
14
15
end
15
16
17
+ M .refresh = function (state )
18
+ manager .refresh (" example" , state )
19
+ end
20
+
16
21
M .show_debug_info = function (state )
17
22
print (vim .inspect (state ))
18
23
end
Original file line number Diff line number Diff line change @@ -62,22 +62,26 @@ M.navigate = function(state, path)
62
62
id = " 1" ,
63
63
name = " root" ,
64
64
type = " directory" ,
65
+ stat_provider = " example-custom" ,
65
66
children = {
66
67
{
67
68
id = " 1.1" ,
68
69
name = " child1" ,
69
70
type = " directory" ,
71
+ stat_provider = " example-custom" ,
70
72
children = {
71
73
{
72
74
id = " 1.1.1" ,
73
75
name = " child1.1 (you'll need a custom renderer to display this properly)" ,
74
76
type = " custom" ,
77
+ stat_provider = " example-custom" ,
75
78
extra = { custom_text = " HI!" },
76
79
},
77
80
{
78
81
id = " 1.1.2" ,
79
82
name = " child1.2" ,
80
- type = " file"
83
+ type = " file" ,
84
+ stat_provider = " example-custom" ,
81
85
},
82
86
},
83
87
},
91
95
--- @param config table Configuration table containing any keys that the user
92
96
-- wants to change from the defaults. May be empty to accept default values.
93
97
M .setup = function (config , global_config )
98
+ -- redister or custom stat provider to override the default libuv one
99
+ require (" neo-tree.utils" ).register_stat_provider (" example-custom" , M .get_node_stat )
94
100
-- You most likely want to use this function to subscribe to events
95
101
if config .use_libuv_file_watcher then
96
102
manager .subscribe (M .name , {
You can’t perform that action at this time.
0 commit comments