Skip to content

Commit

Permalink
Add 'b' binding to jump to bookmark table
Browse files Browse the repository at this point in the history
  • Loading branch information
ds2606 committed Apr 12, 2022
1 parent eed488b commit b153732
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.10
- **.17**: Add 'b' binding to to jump to bookmark table. (ds2606) [#1305](https://github.com/preservim/nerdtree/pull/1305)
- **.16**: Fix documentation errors. (lifecrisis) [#1269](https://github.com/preservim/nerdtree/pull/1269)
- **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266)
- **.14**: Replace trim() with a version-compatible alternative. (PhilRunninger) [#1265](https://github.com/preservim/nerdtree/pull/1265)
Expand Down
12 changes: 12 additions & 0 deletions autoload/nerdtree/ui_glue.vim
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpRoot, 'scope': 'all', 'callback': s.'jumpToRoot' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpNextSibling, 'scope': 'Node', 'callback': s.'jumpToNextSibling' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpPrevSibling, 'scope': 'Node', 'callback': s.'jumpToPrevSibling' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapJumpBookmarks, 'scope': 'all', 'callback': s.'jumpToBookmarks' })

call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTab, 'scope': 'Node', 'callback': s . 'openInNewTab' })
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenInTabSilent, 'scope': 'Node', 'callback': s . 'openInNewTabSilent' })
Expand Down Expand Up @@ -495,6 +496,17 @@ function! s:jumpToSibling(node, forward) abort
call b:NERDTree.ui.centerView()
endfunction

" FUNCTION: s:jumpToBookmarks() {{{1
" moves the cursor to the bookmark listing
function! s:jumpToBookmarks() abort
try
call g:NERDTree.CursorToBookmarkTable()
catch /^NERDTree.BookmarkTableNotFoundError\|^NERDTree.IllegalOperationError/
call nerdtree#echoError('bookmark table is closed')
return
endtry
endfunction

" FUNCTION: nerdtree#ui_glue#openBookmark(name) {{{1
" Open the Bookmark that has the specified name. This function provides the
" implementation for the :OpenBookmark command.
Expand Down
1 change: 1 addition & 0 deletions lib/nerdtree/ui.vim
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function! s:UI._dumpHelp()
let help .= "\"\n\" ----------------------------\n"
let help .= "\" Bookmark table mappings~\n"
let help .= "\" double-click,\n"
let help .= '" '. g:NERDTreeMapJumpBookmarks .": jump to bookmark table\n"
let help .= '" '. g:NERDTreeMapActivateNode .": open bookmark\n"
let help .= '" '. g:NERDTreeMapPreview .": preview file\n"
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
Expand Down
1 change: 1 addition & 0 deletions plugin/NERD_tree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ endif

"SECTION: Init variable calls for key mappings {{{2
let g:NERDTreeMapCustomOpen = get(g:, 'NERDTreeMapCustomOpen', '<CR>')
let g:NERDTreeMapJumpBookmarks = get(g:, 'NERDTreeMapJumpBookmarks', 'b')
let g:NERDTreeMapActivateNode = get(g:, 'NERDTreeMapActivateNode', 'o')
let g:NERDTreeMapChangeRoot = get(g:, 'NERDTreeMapChangeRoot', 'C')
let g:NERDTreeMapChdir = get(g:, 'NERDTreeMapChdir', 'cd')
Expand Down

0 comments on commit b153732

Please sign in to comment.