mirror of
https://github.com/amix/vimrc
synced 2025-06-30 20:05:01 +08:00
Updated plugins
This commit is contained in:
@ -234,6 +234,38 @@ function! nerdtree#pathEquals(lhs, rhs) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: nerdtree#onBufLeave() {{{2
|
||||
" used for handling the nerdtree BufLeave/WinLeave events.
|
||||
function! nerdtree#onBufLeave() abort
|
||||
" detect whether we are in the middle of sourcing a session.
|
||||
" if it is a buffer from the sourced session we need to restore it.
|
||||
if exists('g:SessionLoad') && !exists('b:NERDTree')
|
||||
let bname = bufname('%')
|
||||
" is the buffer for a tab tree?
|
||||
if bname =~# '^' . g:NERDTreeCreator.BufNamePrefix() . 'tab_\d\+$'
|
||||
" rename loaded buffer and mark it as trash to prevent this event
|
||||
" getting fired again
|
||||
exec 'file TRASH_' . bname
|
||||
" delete the trash buffer
|
||||
exec 'bwipeout!'
|
||||
" rescue the tab tree at the current working directory
|
||||
call g:NERDTreeCreator.CreateTabTree(getcwd())
|
||||
" is the buffer for a window tree?
|
||||
elseif bname =~# '^' . g:NERDTreeCreator.BufNamePrefix(). 'win_\d\+$'
|
||||
" rescue the window tree at the current working directory
|
||||
call g:NERDTreeCreator.CreateWindowTree(getcwd())
|
||||
else " unknown buffer type
|
||||
" rename buffer to mark it as broken.
|
||||
exec 'file BROKEN_' . bname
|
||||
call nerdtree#echoError('Failed to restore "' . bname . '" from session. Is this session created with an older version of NERDTree?')
|
||||
endif
|
||||
else
|
||||
if g:NERDTree.IsOpen()
|
||||
call b:NERDTree.ui.saveScreenState()
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" SECTION: View Functions {{{1
|
||||
"============================================================
|
||||
|
||||
|
@ -70,6 +70,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' })
|
||||
@ -496,6 +497,21 @@ function! s:jumpToSibling(node, forward) abort
|
||||
call b:NERDTree.ui.centerView()
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:jumpToBookmarks() {{{1
|
||||
" moves the cursor to the bookmark table
|
||||
function! s:jumpToBookmarks() abort
|
||||
try
|
||||
if b:NERDTree.ui.getShowBookmarks()
|
||||
call g:NERDTree.CursorToBookmarkTable()
|
||||
else
|
||||
call b:NERDTree.ui.setShowBookmarks(1)
|
||||
endif
|
||||
catch /^NERDTree/
|
||||
call nerdtree#echoError('Failed to jump to the bookmark table')
|
||||
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.
|
||||
|
Reference in New Issue
Block a user