mirror of
https://github.com/amix/vimrc
synced 2025-06-17 19:35:00 +08:00
Updated plugins
This commit is contained in:
@ -30,9 +30,11 @@ endfunction
|
||||
" SECTION: General Functions {{{1
|
||||
"============================================================
|
||||
|
||||
"FUNCTION: nerdtree#slash() {{{2
|
||||
" FUNCTION: nerdtree#slash() {{{2
|
||||
" Return the path separator used by the underlying file system. Special
|
||||
" consideration is taken for the use of the 'shellslash' option on Windows
|
||||
" systems.
|
||||
function! nerdtree#slash() abort
|
||||
|
||||
if nerdtree#runningWindows()
|
||||
if exists('+shellslash') && &shellslash
|
||||
return '/'
|
||||
@ -108,15 +110,15 @@ function! nerdtree#completeBookmarks(A,L,P) abort
|
||||
return filter(g:NERDTreeBookmark.BookmarkNames(), 'v:val =~# "^' . a:A . '"')
|
||||
endfunction
|
||||
|
||||
"FUNCTION: nerdtree#compareNodes(dir) {{{2
|
||||
"FUNCTION: nerdtree#compareNodes(n1, n2) {{{2
|
||||
function! nerdtree#compareNodes(n1, n2) abort
|
||||
return a:n1.path.compareTo(a:n2.path)
|
||||
return nerdtree#compareNodePaths(a:n1.path, a:n2.path)
|
||||
endfunction
|
||||
|
||||
"FUNCTION: nerdtree#compareNodesBySortKey(n1, n2) {{{2
|
||||
function! nerdtree#compareNodesBySortKey(n1, n2) abort
|
||||
let sortKey1 = a:n1.path.getSortKey()
|
||||
let sortKey2 = a:n2.path.getSortKey()
|
||||
"FUNCTION: nerdtree#compareNodePaths(p1, p2) {{{2
|
||||
function! nerdtree#compareNodePaths(p1, p2) abort
|
||||
let sortKey1 = a:p1.getSortKey()
|
||||
let sortKey2 = a:p2.getSortKey()
|
||||
let i = 0
|
||||
while i < min([len(sortKey1), len(sortKey2)])
|
||||
" Compare chunks upto common length.
|
||||
|
@ -25,12 +25,16 @@ function! nerdtree#ui_glue#createDefaultBindings() abort
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Bookmark', 'callback': s.'previewBookmark' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapActivateNode, 'scope': 'all', 'callback': s.'activateAll' })
|
||||
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Node', 'callback': s.'openHSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Node', 'callback': s.'openVSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'FileNode', 'callback': s.'openHSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenSplit, 'scope': 'Bookmark', 'callback': s.'openHSplitBookmark' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'FileNode', 'callback': s.'openVSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenVSplit, 'scope': 'Bookmark', 'callback': s.'openVSplitBookmark' })
|
||||
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'Node', 'callback': s.'previewNodeCurrent' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Node', 'callback': s.'previewNodeVSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Node', 'callback': s.'previewNodeHSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreview, 'scope': 'FileNode', 'callback': s.'previewNodeCurrent' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'FileNode', 'callback': s.'previewNodeHSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeHSplitBookmark' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'FileNode', 'callback': s.'previewNodeVSplit' })
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapPreviewVSplit, 'scope': 'Bookmark', 'callback': s.'previewNodeVSplitBookmark' })
|
||||
|
||||
call NERDTreeAddKeyMap({ 'key': g:NERDTreeMapOpenRecursively, 'scope': 'DirNode', 'callback': s.'openNodeRecursively' })
|
||||
|
||||
@ -511,6 +515,28 @@ function! s:openVSplit(target) abort
|
||||
call a:target.activate({'where': 'v'})
|
||||
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'} : {})
|
||||
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'} : {})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:previewHSplitBookmark(bookmark) {{{1
|
||||
function! s:previewNodeHSplitBookmark(bookmark) abort
|
||||
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:previewVSplitBookmark(bookmark) {{{1
|
||||
function! s:previewNodeVSplitBookmark(bookmark) abort
|
||||
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'v', 'keepopen': 1} : {})
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:openExplorer(node) {{{1
|
||||
function! s:openExplorer(node) abort
|
||||
call a:node.openExplorer()
|
||||
@ -538,11 +564,7 @@ endfunction
|
||||
|
||||
" FUNCTION: s:previewBookmark(bookmark) {{{1
|
||||
function! s:previewBookmark(bookmark) abort
|
||||
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
|
||||
call a:bookmark.activate(b:NERDTree, !a:bookmark.path.isDirectory ? {'stay': 1, 'where': 'h', 'keepopen': 1} : {})
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:previewNodeCurrent(node) {{{1
|
||||
|
Reference in New Issue
Block a user