mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 19:33:50 -05:00
put cursor on new node after copying
This commit is contained in:
@@ -169,10 +169,11 @@ endfunction
|
|||||||
function! s:oTreeFileNode.Copy(dest) dict
|
function! s:oTreeFileNode.Copy(dest) dict
|
||||||
call self.path.Copy(a:dest)
|
call self.path.Copy(a:dest)
|
||||||
let newPath = s:oPath.New(a:dest)
|
let newPath = s:oPath.New(a:dest)
|
||||||
let parentNode = t:NERDTreeRoot.FindNode(newPath.GetParent())
|
let parent = t:NERDTreeRoot.FindNode(newPath.GetParent())
|
||||||
if !empty(parentNode)
|
if !empty(parent)
|
||||||
call parentNode.Refresh()
|
call parent.Refresh()
|
||||||
endif
|
endif
|
||||||
|
return parent.FindNode(newPath)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: oTreeFileNode.Delete {{{3
|
"FUNCTION: oTreeFileNode.Delete {{{3
|
||||||
@@ -2507,12 +2508,13 @@ function! s:CopyNode()
|
|||||||
|
|
||||||
if confirmed
|
if confirmed
|
||||||
try
|
try
|
||||||
call currentNode.Copy(newNodePath)
|
let newNode = currentNode.Copy(newNodePath)
|
||||||
|
call s:RenderView()
|
||||||
|
call s:PutCursorOnNode(newNode, 0)
|
||||||
catch /^NERDTree/
|
catch /^NERDTree/
|
||||||
call s:EchoWarning("Could not copy node")
|
call s:EchoWarning("Could not copy node")
|
||||||
endtry
|
endtry
|
||||||
endif
|
endif
|
||||||
call s:RenderView()
|
|
||||||
else
|
else
|
||||||
call s:Echo("Copy aborted.")
|
call s:Echo("Copy aborted.")
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user