@@ -6,31 +6,34 @@ local explorer_node = require "nvim-tree.explorer.node"
6
6
7
7
local M = {}
8
8
9
- --- @param where string
10
- --- @param what string
9
+ --- @class NavigationItemOpts
10
+ --- @field where string
11
+ --- @field what string
12
+
13
+ --- @param opts NavigationItemOpts
11
14
--- @return fun ()
12
- function M .fn (where , what )
15
+ function M .fn (opts )
13
16
return function ()
14
17
local node_cur = lib .get_node_at_cursor ()
15
18
local first_node_line = core .get_nodes_starting_line ()
16
19
local nodes_by_line = utils .get_nodes_by_line (core .get_explorer ().nodes , first_node_line )
17
20
local iter_start , iter_end , iter_step , cur , first , nex
18
21
19
- if where == " next" then
22
+ if opts . where == " next" then
20
23
iter_start , iter_end , iter_step = first_node_line , # nodes_by_line , 1
21
- elseif where == " prev" then
24
+ elseif opts . where == " prev" then
22
25
iter_start , iter_end , iter_step = # nodes_by_line , first_node_line , - 1
23
26
end
24
27
25
28
for line = iter_start , iter_end , iter_step do
26
29
local node = nodes_by_line [line ]
27
30
local valid = false
28
31
29
- if what == " git" then
32
+ if opts . what == " git" then
30
33
valid = explorer_node .get_git_status (node ) ~= nil
31
- elseif what == " diag" then
34
+ elseif opts . what == " diag" then
32
35
valid = node .diag_status ~= nil
33
- elseif what == " opened" then
36
+ elseif opts . what == " opened" then
34
37
valid = vim .fn .bufloaded (node .absolute_path ) ~= 0
35
38
end
36
39
0 commit comments