Merge pull request #721 from lifecrisis/issue67
UPDATE: The `p` mapping now works on cascades.
This commit is contained in:
commit
a3fdf1e3c1
@ -404,13 +404,27 @@ function! s:jumpToLastChild(node)
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:jumpToParent(node) {{{1
|
" FUNCTION: s:jumpToParent(node) {{{1
|
||||||
" moves the cursor to the parent of the current node
|
" Move the cursor to the parent of the specified node. For a cascade, move to
|
||||||
|
" the parent of the cascade's highest node. At the root, do nothing.
|
||||||
function! s:jumpToParent(node)
|
function! s:jumpToParent(node)
|
||||||
if !empty(a:node.parent)
|
let l:parent = a:node.parent
|
||||||
call a:node.parent.putCursorHere(1, 0)
|
|
||||||
|
" If "a:node" represents a directory, back out of its cascade.
|
||||||
|
if a:node.path.isDirectory
|
||||||
|
while !empty(l:parent) && !l:parent.isRoot()
|
||||||
|
if index(l:parent.getCascade(), a:node) >= 0
|
||||||
|
let l:parent = l:parent.parent
|
||||||
|
else
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty(l:parent)
|
||||||
|
call l:parent.putCursorHere(1, 0)
|
||||||
call b:NERDTree.ui.centerView()
|
call b:NERDTree.ui.centerView()
|
||||||
else
|
else
|
||||||
call nerdtree#echo("cannot jump to parent")
|
call nerdtree#echo('could not jump to parent node')
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user