jump to the bookmarks table after opening it
when the user hits B and opens the bookmarks table, stick the cursor at the top of it
This commit is contained in:
parent
236df49362
commit
43bf05c42e
@ -877,6 +877,7 @@ fridge for later ;)
|
|||||||
2.x.x
|
2.x.x
|
||||||
- make the t/T on directory nodes open a fresh NERD tree for the selected
|
- make the t/T on directory nodes open a fresh NERD tree for the selected
|
||||||
dir in a new tab, rather than a netrw.
|
dir in a new tab, rather than a netrw.
|
||||||
|
- place the cursor at the top of the bookmarks table when opening it with B
|
||||||
|
|
||||||
2.12.0
|
2.12.0
|
||||||
- added a UI for bookmarks. See :help NERDTreeBookmarkTable for details.
|
- added a UI for bookmarks. See :help NERDTreeBookmarkTable for details.
|
||||||
|
@ -2368,6 +2368,25 @@ function! s:PromptToDelBuffer(bufnum, msg)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
"FUNCTION: s:PutCursorOnBookmarkTable(){{{2
|
||||||
|
"Places the cursor at the top of the bookmarks table
|
||||||
|
function! s:PutCursorOnBookmarkTable()
|
||||||
|
if !t:NERDTreeShowBookmarks
|
||||||
|
throw "NERDTree.IllegalOperation exception: cant find bookmark table, bookmarks arent active"
|
||||||
|
endif
|
||||||
|
|
||||||
|
let rootNodeLine = s:FindRootNodeLineNumber()
|
||||||
|
|
||||||
|
let line = 1
|
||||||
|
while getline(line) !~ '^>-\+Bookmarks-\+$'
|
||||||
|
let line = line + 1
|
||||||
|
if line >= rootNodeLine
|
||||||
|
throw "NERDTree.BookmarkTableNotFound exception: didnt find the bookmarks table"
|
||||||
|
endif
|
||||||
|
endwhile
|
||||||
|
call cursor(line, 0)
|
||||||
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:PutCursorOnNode(treenode, isJump, recurseUpward){{{2
|
"FUNCTION: s:PutCursorOnNode(treenode, isJump, recurseUpward){{{2
|
||||||
"Places the cursor on the line number representing the given node
|
"Places the cursor on the line number representing the given node
|
||||||
"
|
"
|
||||||
@ -3390,7 +3409,12 @@ endfunction
|
|||||||
" toggles the display of bookmarks
|
" toggles the display of bookmarks
|
||||||
function! s:ToggleShowBookmarks()
|
function! s:ToggleShowBookmarks()
|
||||||
let t:NERDTreeShowBookmarks = !t:NERDTreeShowBookmarks
|
let t:NERDTreeShowBookmarks = !t:NERDTreeShowBookmarks
|
||||||
call s:RenderViewSavingPosition()
|
if t:NERDTreeShowBookmarks
|
||||||
|
call s:RenderView()
|
||||||
|
call s:PutCursorOnBookmarkTable()
|
||||||
|
else
|
||||||
|
call s:RenderViewSavingPosition()
|
||||||
|
endif
|
||||||
call s:CenterView()
|
call s:CenterView()
|
||||||
endfunction
|
endfunction
|
||||||
" FUNCTION: s:ToggleShowFiles() {{{2
|
" FUNCTION: s:ToggleShowFiles() {{{2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user