File tree Expand file tree Collapse file tree 6 files changed +14
-15
lines changed Expand file tree Collapse file tree 6 files changed +14
-15
lines changed Original file line number Diff line number Diff line change 11{
22 "$schema" : " https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json" ,
33 "workspace" : {
4- "library" : [
5- " $VIMRUNTIME/lua/vim" ,
6- " ${3rd}/luv/library"
7- ]
4+ "library" : [" $VIMRUNTIME/lua/vim" , " ${3rd}/luv/library" ]
85 },
96 "format" : {
107 "defaultConfig" : {
Original file line number Diff line number Diff line change @@ -170,7 +170,7 @@ Api.tree.change_root_to_node = wrap_node(function(node)
170170end )
171171
172172
173- Api .tree .change_root_to_parent = wrap_node (Explorer . dir_up )
173+ Api .tree .change_root_to_parent = wrap_node (wrap_explorer ( " dir_up" ) )
174174Api .tree .get_node_under_cursor = wrap_explorer (" get_node_at_cursor" )
175175Api .tree .get_nodes = wrap_explorer (" get_nodes" )
176176
Original file line number Diff line number Diff line change 6666
6767--- @return boolean
6868local function should_change_dir ()
69- local explorer = core .get_explorer ()
7069 return M .options .enable and vim .tbl_isempty (vim .v .event )
7170end
7271
Original file line number Diff line number Diff line change 11local utils = require (" nvim-tree.utils" )
22local core = require (" nvim-tree.core" )
3+ local change_dir = require (" nvim-tree.explorer.change-dir" )
4+ local find_file = require (" nvim-tree.actions.finders.find-file" )
35
46local M = {}
57
68function M .fn (node )
79 if not node or node .name == " .." then
8- require ( " lua.nvim-tree.explorer.change-dir " ) .fn (" .." )
10+ change_dir .fn (" .." )
911 else
1012 local cwd = core .get_cwd ()
1113 if cwd == nil then
1214 return
1315 end
1416
1517 local newdir = vim .fn .fnamemodify (utils .path_remove_trailing (cwd ), " :h" )
16- require ( " lua.nvim-tree.explorer.change-dir " ) .fn (newdir )
17- require ( " nvim-tree.actions.finders.find-file " ) .fn (node .absolute_path )
18+ change_dir .fn (newdir )
19+ find_file .fn (node .absolute_path )
1820 end
1921end
2022
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ local Renderer = require("nvim-tree.renderer")
2424local FILTER_REASON = require (" nvim-tree.enum" ).FILTER_REASON
2525
2626local change_dir = require (" nvim-tree.explorer.change-dir" )
27+ local find_file = require (" nvim-tree.actions.finders.find-file" )
2728
2829
2930local config
@@ -70,6 +71,7 @@ function Explorer:new(args)
7071 self .clipboard = Clipboard ({ explorer = self })
7172
7273 self :create_autocmds ()
74+ self .change_dir = change_dir
7375
7476 self :_load (self )
7577end
@@ -672,20 +674,18 @@ end
672674--- @param node Node
673675function Explorer :dir_up (node )
674676 if not node or node .name == " .." then
675- require ( " nvim-tree.explorer.change-dir " ) .fn (" .." )
677+ change_dir .fn (" .." )
676678 else
677679 local cwd = core .get_cwd ()
678680 if cwd == nil then
679681 return
680682 end
681683 local newdir = vim .fn .fnamemodify (utils .path_remove_trailing (cwd ), " :h" )
682- require ( " nvim-tree.explorer.change-dir " ) .fn (newdir )
683- require ( " nvim-tree.actions.finders.find-file " ) .fn (node .absolute_path )
684+ change_dir .fn (newdir )
685+ find_file .fn (node .absolute_path )
684686 end
685687end
686688
687- Explorer .change_dir = change_dir
688-
689689function Explorer :setup (opts )
690690 config = opts
691691 change_dir .setup (opts )
Original file line number Diff line number Diff line change 11local view = require (" nvim-tree.view" )
22local core = require (" nvim-tree.core" )
33local notify = require (" nvim-tree.notify" )
4+ local change_dir = require (" nvim-tree.explorer.change-dir" )
45
56--- @class LibOpenOpts
67--- @field path string | nil path
2526--- @param cwd string
2627local function handle_buf_cwd (cwd )
2728 if M .respect_buf_cwd and cwd ~= core .get_cwd () then
28- require ( " lua.nvim-tree.explorer.change-dir " ) .fn (cwd )
29+ change_dir .fn (cwd )
2930 end
3031end
3132
You can’t perform that action at this time.
0 commit comments