commit 456367ab07cd9d866b503a25e52aaa5a9fd8ad1f
parent eee179f0bf36a314f48b231e3772b06ce9406c94
Author: Jason Franklin <j_fra@fastmail.us>
Date: Thu, 2 Aug 2018 09:17:18 -0400
Put cursor on root when closing bookmark table
If the cursor is not already positioned on a node when the bookmark
table is closed, then the resulting position of the cursor is not
determined. Here, we default to positioning the cursor on the
root when the bookmark table is closed.
Diffstat:
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/lib/nerdtree/ui.vim b/lib/nerdtree/ui.vim
@@ -475,15 +475,23 @@ function! s:UI.toggleIgnoreFilter()
endfunction
" FUNCTION: s:UI.toggleShowBookmarks() {{{1
-" toggles the display of bookmarks
+" Toggle the visibility of the Bookmark table.
function! s:UI.toggleShowBookmarks()
let self._showBookmarks = !self._showBookmarks
+
if self.getShowBookmarks()
call self.nerdtree.render()
call g:NERDTree.CursorToBookmarkTable()
else
+
+ if empty(g:NERDTreeFileNode.GetSelected())
+ call b:NERDTree.root.putCursorHere(0, 0)
+ normal! 0
+ endif
+
call self.renderViewSavingPosition()
endif
+
call self.centerView()
endfunction