mirror of
https://github.com/preservim/nerdtree.git
synced 2024-11-22 14:10:07 +08:00
make MarkToRoot() work for nodes that arent cached
now if you go :MarkToRoot foo and foo points to a path that isnt cached, a new tree node will be created and made root. Note that all cached nodes will be lost as this is the same as opening a new nerd tree
This commit is contained in:
parent
371379a860
commit
82c1fece9f
|
@ -2864,7 +2864,12 @@ endfunction
|
|||
" FUNCTION: s:MarkToRoot(name) {{{2
|
||||
" Make the node for the given mark the new tree root
|
||||
function! s:MarkToRoot(name)
|
||||
let targetNode = s:GetNodeForMark(a:name, 1)
|
||||
try
|
||||
let targetNode = s:GetNodeForMark(a:name, 1)
|
||||
catch /NERDTree.MarkNotFound/
|
||||
let marks = s:GetMarks()
|
||||
let targetNode = s:oTreeFileNode.New(marks[a:name])
|
||||
endtry
|
||||
call targetNode.MakeRoot()
|
||||
call s:RenderView()
|
||||
call s:PutCursorOnNode(targetNode, 0, 0)
|
||||
|
|
Loading…
Reference in New Issue
Block a user