mirror of
https://github.com/amix/vimrc
synced 2025-07-08 18:04:59 +08:00
Updated plugins
This commit is contained in:
@ -108,10 +108,17 @@ function! s:customOpenBookmark(node) abort
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:initCustomOpenArgs() {{{1
|
||||
" Make sure NERDTreeCustomOpenArgs has needed keys
|
||||
function! s:initCustomOpenArgs() abort
|
||||
let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
|
||||
return extend(g:NERDTreeCustomOpenArgs, {'file':{'reuse': 'all', 'where': 'p'}, 'dir':{}}, 'keep')
|
||||
let l:defaultOpenArgs = {'file': {'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()}, 'dir': {}}
|
||||
try
|
||||
let g:NERDTreeCustomOpenArgs = get(g:, 'NERDTreeCustomOpenArgs', {})
|
||||
call extend(g:NERDTreeCustomOpenArgs, l:defaultOpenArgs, 'keep')
|
||||
catch /^Vim(\a\+):E712:/
|
||||
call nerdtree#echoWarning('g:NERDTreeCustomOpenArgs is not set properly. Using default value.')
|
||||
let g:NERDTreeCustomOpenArgs = l:defaultOpenArgs
|
||||
finally
|
||||
return g:NERDTreeCustomOpenArgs
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:activateAll() {{{1
|
||||
@ -137,13 +144,13 @@ endfunction
|
||||
"FUNCTION: s:activateFileNode() {{{1
|
||||
"handle the user activating a tree node
|
||||
function! s:activateFileNode(node) abort
|
||||
call a:node.activate({'reuse': 'all', 'where': 'p'})
|
||||
call a:node.activate({'reuse': 'all', 'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:activateBookmark(bookmark) {{{1
|
||||
"handle the user activating a bookmark
|
||||
function! s:activateBookmark(bm) abort
|
||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p'} : {})
|
||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'p', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: nerdtree#ui_glue#bookmarkNode(name) {{{1
|
||||
@ -366,7 +373,7 @@ function! s:handleLeftClick() abort
|
||||
if currentNode.path.isDirectory
|
||||
call currentNode.activate()
|
||||
else
|
||||
call currentNode.activate({'reuse': 'all', 'where': 'p'})
|
||||
call currentNode.activate({'reuse': 'all', 'where': 'p', 'keepopen':!nerdtree#closeTreeOnOpen()})
|
||||
endif
|
||||
return
|
||||
endif
|
||||
@ -500,31 +507,32 @@ function! nerdtree#ui_glue#openBookmark(name) abort
|
||||
endtry
|
||||
if l:bookmark.path.isDirectory
|
||||
call l:bookmark.open(b:NERDTree)
|
||||
else
|
||||
call l:bookmark.open(b:NERDTree, {'where': 'p'})
|
||||
return
|
||||
endif
|
||||
|
||||
call l:bookmark.open(b:NERDTree, s:initCustomOpenArgs().file)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:openHSplit(target) {{{1
|
||||
function! s:openHSplit(target) abort
|
||||
call a:target.activate({'where': 'h'})
|
||||
call a:target.activate({'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:openVSplit(target) {{{1
|
||||
function! s:openVSplit(target) abort
|
||||
call a:target.activate({'where': 'v'})
|
||||
call a:target.activate({'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:openHSplitBookmark(bookmark) {{{1
|
||||
"handle the user activating a bookmark
|
||||
function! s:openHSplitBookmark(bm) abort
|
||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h'} : {})
|
||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'h', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:openVSplitBookmark(bookmark) {{{1
|
||||
"handle the user activating a bookmark
|
||||
function! s:openVSplitBookmark(bm) abort
|
||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v'} : {})
|
||||
call a:bm.activate(b:NERDTree, !a:bm.path.isDirectory ? {'where': 'v', 'keepopen': !nerdtree#closeTreeOnOpen()} : {})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
|
||||
@ -544,13 +552,13 @@ endfunction
|
||||
|
||||
" FUNCTION: s:openInNewTab(target) {{{1
|
||||
function! s:openInNewTab(target) abort
|
||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't'})
|
||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen()})
|
||||
call l:opener.open(a:target)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:openInNewTabSilent(target) {{{1
|
||||
function! s:openInNewTabSilent(target) abort
|
||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'stay': 1})
|
||||
let l:opener = g:NERDTreeOpener.New(a:target.path, {'where': 't', 'keepopen': !nerdtree#closeTreeOnOpen(), 'stay': 1})
|
||||
call l:opener.open(a:target)
|
||||
endfunction
|
||||
|
||||
@ -564,7 +572,11 @@ endfunction
|
||||
|
||||
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
||||
function! s:previewBookmark(bookmark) abort
|
||||
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||
if a:bookmark.path.isDirectory
|
||||
execute 'NERDTreeFind '.a:bookmark.path.str()
|
||||
else
|
||||
call a:bookmark.activate(b:NERDTree, {'stay': 1, 'where': 'p', 'keepopen': 1})
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
||||
@ -589,7 +601,7 @@ function! nerdtree#ui_glue#revealBookmark(name) abort
|
||||
let targetNode = g:NERDTreeBookmark.GetNodeForName(a:name, 0, b:NERDTree)
|
||||
call targetNode.putCursorHere(0, 1)
|
||||
catch /^NERDTree.BookmarkNotFoundError/
|
||||
call nerdtree#echo('Bookmark isnt cached under the current root')
|
||||
call nerdtree#echo('Bookmark isn''t cached under the current root')
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
|
Reference in New Issue
Block a user