File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ local notify = require("nvim-tree.notify")
1010
1111local DirectoryNode = require (" nvim-tree.node.directory" )
1212local FileLinkNode = require (" nvim-tree.node.file-link" )
13+ local FileNode = require (" nvim-tree.node.file" )
1314local RootNode = require (" nvim-tree.node.root" )
1415local UserDecorator = require (" nvim-tree.renderer.decorator.user" )
1516
160161Api .tree .change_root_to_node = wrap_node (function (node )
161162 if node .name == " .." or node :is (RootNode ) then
162163 wrap_explorer (" change_dir" )(" .." )
164+ elseif node :is (FileNode ) and node .parent ~= nil then
165+ wrap_explorer (" change_dir" )(node .parent :last_group_node ().absolute_path )
163166 else
164167 node = node :as (DirectoryNode )
165168 if node then
Original file line number Diff line number Diff line change 716716--- @return boolean
717717function Explorer :prevent_cwd_change (foldername )
718718 local is_same_cwd = foldername == self .absolute_path
719- local is_restricted_above = config .restrict_above_cwd and foldername < vim .fn .getcwd (- 1 , - 1 )
719+ local is_restricted_above = config .actions . change_dir . restrict_above_cwd and foldername < vim .fn .getcwd (- 1 , - 1 )
720720 return is_same_cwd or is_restricted_above
721721end
722722
You can’t perform that action at this time.
0 commit comments