mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-09 20:03:48 -05:00
add keymap to delete bookmarks
This commit is contained in:
@@ -202,6 +202,8 @@ double-click.......same as the |NERDTree-o| map.
|
|||||||
middle-click.......same as |NERDTree-tab| for files, same as
|
middle-click.......same as |NERDTree-tab| for files, same as
|
||||||
|NERDTree-e| for dirs.
|
|NERDTree-e| for dirs.
|
||||||
|
|
||||||
|
D.......Delete the current bookmark .............................|NERDTree-D|
|
||||||
|
|
||||||
P.......Jump to the root node....................................|NERDTree-P|
|
P.......Jump to the root node....................................|NERDTree-P|
|
||||||
p.......Jump to current nodes parent.............................|NERDTree-p|
|
p.......Jump to current nodes parent.............................|NERDTree-p|
|
||||||
K.......Jump up inside directories at the current tree depth.....|NERDTree-K|
|
K.......Jump up inside directories at the current tree depth.....|NERDTree-K|
|
||||||
@@ -342,6 +344,14 @@ Applies to: files and directories.
|
|||||||
|
|
||||||
Opens a netrw on the selected directory, or the selected file's directory.
|
Opens a netrw on the selected directory, or the selected file's directory.
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
*NERDTree-D*
|
||||||
|
Default key: D
|
||||||
|
Map option: NERDTreeMapDeleteBookmark
|
||||||
|
Applies to: lines in the bookmarks table
|
||||||
|
|
||||||
|
Deletes the currently selected bookmark.
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTree-P*
|
*NERDTree-P*
|
||||||
Default key: P
|
Default key: P
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ call s:InitVariable("g:NERDTreeMapChangeRoot", "C")
|
|||||||
call s:InitVariable("g:NERDTreeMapChdir", "cd")
|
call s:InitVariable("g:NERDTreeMapChdir", "cd")
|
||||||
call s:InitVariable("g:NERDTreeMapCloseChildren", "X")
|
call s:InitVariable("g:NERDTreeMapCloseChildren", "X")
|
||||||
call s:InitVariable("g:NERDTreeMapCloseDir", "x")
|
call s:InitVariable("g:NERDTreeMapCloseDir", "x")
|
||||||
|
call s:InitVariable("g:NERDTreeMapDeleteBookmark", "D")
|
||||||
call s:InitVariable("g:NERDTreeMapExecute", "!")
|
call s:InitVariable("g:NERDTreeMapExecute", "!")
|
||||||
call s:InitVariable("g:NERDTreeMapFilesystemMenu", "m")
|
call s:InitVariable("g:NERDTreeMapFilesystemMenu", "m")
|
||||||
call s:InitVariable("g:NERDTreeMapHelp", "?")
|
call s:InitVariable("g:NERDTreeMapHelp", "?")
|
||||||
@@ -1985,6 +1986,7 @@ function! s:DumpHelp()
|
|||||||
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
|
let @h=@h."\" ". g:NERDTreeMapActivateNode .": open bookmark\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
let @h=@h."\" ". g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||||
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
let @h=@h."\" ". g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||||
|
let @h=@h."\" ". g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||||
|
|
||||||
let @h=@h."\"\n\" ----------------------------\n"
|
let @h=@h."\"\n\" ----------------------------\n"
|
||||||
let @h=@h."\" Tree navigation mappings~\n"
|
let @h=@h."\" Tree navigation mappings~\n"
|
||||||
@@ -2918,6 +2920,8 @@ function! s:BindMappings()
|
|||||||
|
|
||||||
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapOpenExpl ." :call <SID>OpenExplorer()<cr>"
|
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapOpenExpl ." :call <SID>OpenExplorer()<cr>"
|
||||||
|
|
||||||
|
exec "nnoremap <silent> <buffer> ". g:NERDTreeMapDeleteBookmark ." :call <SID>DeleteBookmark()<cr>"
|
||||||
|
|
||||||
command! -buffer -nargs=1 Bookmark :call <SID>BookmarkNode('<args>')
|
command! -buffer -nargs=1 Bookmark :call <SID>BookmarkNode('<args>')
|
||||||
command! -buffer -complete=customlist,s:CompleteBookmarks -nargs=1 RevealBookmark :call <SID>RevealBookmark('<args>')
|
command! -buffer -complete=customlist,s:CompleteBookmarks -nargs=1 RevealBookmark :call <SID>RevealBookmark('<args>')
|
||||||
command! -buffer -complete=customlist,s:CompleteBookmarks -nargs=1 OpenBookmark :call <SID>OpenBookmark('<args>')
|
command! -buffer -complete=customlist,s:CompleteBookmarks -nargs=1 OpenBookmark :call <SID>OpenBookmark('<args>')
|
||||||
@@ -3087,6 +3091,31 @@ function! s:CopyNode()
|
|||||||
redraw
|
redraw
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" FUNCTION: s:DeleteBookmark() {{{2
|
||||||
|
" if the cursor is on a bookmark, prompt to delete
|
||||||
|
function! s:DeleteBookmark()
|
||||||
|
let bookmark = s:GetSelectedBookmark()
|
||||||
|
if bookmark == {}
|
||||||
|
call s:Echo("Put the cursor on a bookmark")
|
||||||
|
return
|
||||||
|
endif
|
||||||
|
|
||||||
|
echo "Are you sure you wish to delete the bookmark:\n\"" . bookmark.name . "\" (yN):"
|
||||||
|
|
||||||
|
if nr2char(getchar()) == 'y'
|
||||||
|
try
|
||||||
|
call bookmark.Delete()
|
||||||
|
call s:RenderView()
|
||||||
|
redraw
|
||||||
|
catch /^NERDTree/
|
||||||
|
call s:EchoWarning("Could not remove bookmark")
|
||||||
|
endtry
|
||||||
|
else
|
||||||
|
call s:Echo("delete aborted" )
|
||||||
|
endif
|
||||||
|
|
||||||
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:DeleteNode() {{{2
|
" FUNCTION: s:DeleteNode() {{{2
|
||||||
" if the current node is a file, pops up a dialog giving the user the option
|
" if the current node is a file, pops up a dialog giving the user the option
|
||||||
" to delete it
|
" to delete it
|
||||||
|
|||||||
Reference in New Issue
Block a user