mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05: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:
@@ -2864,7 +2864,12 @@ endfunction
|
|||||||
" FUNCTION: s:MarkToRoot(name) {{{2
|
" FUNCTION: s:MarkToRoot(name) {{{2
|
||||||
" Make the node for the given mark the new tree root
|
" Make the node for the given mark the new tree root
|
||||||
function! s:MarkToRoot(name)
|
function! s:MarkToRoot(name)
|
||||||
|
try
|
||||||
let targetNode = s:GetNodeForMark(a:name, 1)
|
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 targetNode.MakeRoot()
|
||||||
call s:RenderView()
|
call s:RenderView()
|
||||||
call s:PutCursorOnNode(targetNode, 0, 0)
|
call s:PutCursorOnNode(targetNode, 0, 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user