mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -39,10 +39,10 @@ endfunction
|
||||
|
||||
" FUNCTION: Path.cacheDisplayString() {{{1
|
||||
function! s:Path.cacheDisplayString() abort
|
||||
let self.cachedDisplayString = self.getLastPathComponent(1)
|
||||
let self.cachedDisplayString = g:NERDTreeNodeDelimiter . self.getLastPathComponent(1)
|
||||
|
||||
if self.isExecutable
|
||||
let self.cachedDisplayString = self.cachedDisplayString . '*'
|
||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . '*'
|
||||
endif
|
||||
|
||||
let self._bookmarkNames = []
|
||||
@ -52,15 +52,24 @@ function! s:Path.cacheDisplayString() abort
|
||||
endif
|
||||
endfor
|
||||
if !empty(self._bookmarkNames) && g:NERDTreeMarkBookmarks == 1
|
||||
let self.cachedDisplayString .= ' {' . join(self._bookmarkNames) . '}'
|
||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' {' . join(self._bookmarkNames) . '}'
|
||||
endif
|
||||
|
||||
if self.isSymLink
|
||||
let self.cachedDisplayString .= ' -> ' . self.symLinkDest
|
||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' -> ' . self.symLinkDest
|
||||
endif
|
||||
|
||||
if self.isReadOnly
|
||||
let self.cachedDisplayString .= ' ['.g:NERDTreeGlyphReadOnly.']'
|
||||
let self.cachedDisplayString = self.addDelimiter(self.cachedDisplayString) . ' ['.g:NERDTreeGlyphReadOnly.']'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Path.addDelimiter() {{{1
|
||||
function! s:Path.addDelimiter(line)
|
||||
if a:line =~# '\(.*' . g:NERDTreeNodeDelimiter . '\)\{2}'
|
||||
return a:line
|
||||
else
|
||||
return a:line . g:NERDTreeNodeDelimiter
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@ -392,7 +401,17 @@ endfunction
|
||||
" FUNCTION: Path.getSortKey() {{{1
|
||||
" returns a key used in compare function for sorting
|
||||
function! s:Path.getSortKey()
|
||||
if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder
|
||||
let l:ascending = index(g:NERDTreeSortOrder,'[[timestamp]]')
|
||||
let l:descending = index(g:NERDTreeSortOrder,'[[-timestamp]]')
|
||||
if !exists("self._sortKey") || g:NERDTreeSortOrder !=# g:NERDTreeOldSortOrder || l:ascending >= 0 || l:descending >= 0
|
||||
let self._sortKey = [self.getSortOrderIndex()]
|
||||
|
||||
if l:descending >= 0
|
||||
call insert(self._sortKey, -getftime(self.str()), l:descending == 0 ? 0 : len(self._sortKey))
|
||||
elseif l:ascending >= 0
|
||||
call insert(self._sortKey, getftime(self.str()), l:ascending == 0 ? 0 : len(self._sortKey))
|
||||
endif
|
||||
|
||||
let path = self.getLastPathComponent(1)
|
||||
if !g:NERDTreeSortHiddenFirst
|
||||
let path = substitute(path, '^[._]', '', '')
|
||||
@ -400,13 +419,9 @@ function! s:Path.getSortKey()
|
||||
if !g:NERDTreeCaseSensitiveSort
|
||||
let path = tolower(path)
|
||||
endif
|
||||
if !g:NERDTreeNaturalSort
|
||||
let self._sortKey = [self.getSortOrderIndex(), path]
|
||||
else
|
||||
let self._sortKey = [self.getSortOrderIndex()] + self._splitChunks(path)
|
||||
endif
|
||||
endif
|
||||
|
||||
call extend(self._sortKey, (g:NERDTreeNaturalSort ? self._splitChunks(path) : [path]))
|
||||
endif
|
||||
return self._sortKey
|
||||
endfunction
|
||||
|
||||
|
@ -99,7 +99,8 @@ function! s:TreeDirNode.displayString()
|
||||
let l:label = ''
|
||||
let l:cascade = self.getCascade()
|
||||
for l:dirNode in l:cascade
|
||||
let l:label .= l:dirNode.path.displayString()
|
||||
let l:next = l:dirNode.path.displayString()
|
||||
let l:label .= l:label == '' ? l:next : substitute(l:next,'^.','','')
|
||||
endfor
|
||||
|
||||
" Select the appropriate open/closed status indicator symbol.
|
||||
@ -304,9 +305,11 @@ function! s:TreeDirNode._glob(pattern, all)
|
||||
for l:file in l:globList
|
||||
let l:tail = fnamemodify(l:file, ':t')
|
||||
|
||||
" Double the modifier if only a separator was stripped.
|
||||
" If l:file has a trailing slash, then its :tail will be ''. Use
|
||||
" :h to drop the slash and the empty string after it; then use :t
|
||||
" to get the directory name.
|
||||
if l:tail == ''
|
||||
let l:tail = fnamemodify(l:file, ':t:t')
|
||||
let l:tail = fnamemodify(l:file, ':h:t')
|
||||
endif
|
||||
|
||||
if l:tail == '.' || l:tail == '..'
|
||||
|
@ -180,7 +180,7 @@ function! s:TreeFileNode.GetSelected()
|
||||
endif
|
||||
|
||||
return b:NERDTree.root.findNode(l:path)
|
||||
catch /^NERDTree/
|
||||
catch
|
||||
return {}
|
||||
endtry
|
||||
endfunction
|
||||
@ -242,7 +242,7 @@ endfunction
|
||||
|
||||
" FUNCTION: TreeFileNode.openInNewTab(options) {{{1
|
||||
function! s:TreeFileNode.openInNewTab(options)
|
||||
echomsg 'TreeFileNode.openInNewTab is deprecated'
|
||||
call nerdtree#deprecated('TreeFileNode.openinNewTab', 'is deprecated, use .open() instead.')
|
||||
call self.open(extend({'where': 't'}, a:options))
|
||||
endfunction
|
||||
|
||||
|
@ -300,7 +300,7 @@ endfunction
|
||||
|
||||
" FUNCTION: s:UI.MarkupReg() {{{1
|
||||
function! s:UI.MarkupReg()
|
||||
return '^\(['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.'] \| \+\)'
|
||||
return '^ *['.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']\? '
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:UI._renderBookmarks {{{1
|
||||
@ -363,30 +363,13 @@ function! s:UI.setShowHidden(val)
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:UI._stripMarkup(line){{{1
|
||||
" returns the given line with all the tree parts stripped off
|
||||
" find the filename in the given line, and return it.
|
||||
"
|
||||
" Args:
|
||||
" line: the subject line
|
||||
function! s:UI._stripMarkup(line)
|
||||
let line = a:line
|
||||
" remove the tree parts and the leading space
|
||||
let line = substitute (line, g:NERDTreeUI.MarkupReg(),"","")
|
||||
|
||||
" strip off any read only flag
|
||||
let line = substitute (line, ' \['.g:NERDTreeGlyphReadOnly.'\]', "","")
|
||||
|
||||
" strip off any bookmark flags
|
||||
let line = substitute (line, ' {[^}]*}', "","")
|
||||
|
||||
" strip off any executable flags
|
||||
let line = substitute (line, '*\ze\($\| \)', "","")
|
||||
|
||||
" strip off any generic flags
|
||||
let line = substitute (line, '\[[^]]*\]', "","")
|
||||
|
||||
let line = substitute (line,' -> .*',"","") " remove link to
|
||||
|
||||
return line
|
||||
let l:line = substitute(a:line, '^.\{-}' . g:NERDTreeNodeDelimiter, '', '')
|
||||
return substitute(l:line, g:NERDTreeNodeDelimiter.'.*$', '', '')
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:UI.render() {{{1
|
||||
|
Reference in New Issue
Block a user