1
0
mirror of https://github.com/amix/vimrc synced 2025-06-16 09:35:01 +08:00

Updated plugins

This commit is contained in:
amix
2016-10-02 13:37:21 +02:00
parent 751af44cbe
commit aad95603ea
60 changed files with 1788 additions and 463 deletions

View File

@ -257,7 +257,7 @@ endfunction
function! s:Opener._openDirectory(node)
if self._nerdtree.isWinTree()
call self._gotoTargetWin()
call g:NERDTreeCreator.CreateWindow(a:node.path.str())
call g:NERDTreeCreator.CreateWindowTree(a:node.path.str())
else
call self._gotoTargetWin()
if empty(self._where)

View File

@ -174,11 +174,15 @@ function! s:Path.copy(dest)
call s:Path.createParentDirectories(a:dest)
let dest = s:Path.WinToUnixPath(a:dest)
if exists('g:NERDTreeCopyCmd')
let cmd_prefix = g:NERDTreeCopyCmd
else
let cmd_prefix = (self.isDirectory ? g:NERDTreeCopyDirCmd : g:NERDTreeCopyFileCmd)
endif
let cmd = g:NERDTreeCopyCmd . " " . escape(self.str(), self._escChars()) . " " . escape(dest, self._escChars())
let cmd = cmd_prefix . " " . escape(self.str(), self._escChars()) . " " . escape(a:dest, self._escChars())
let success = system(cmd)
if success != 0
if v:shell_error != 0
throw "NERDTree.CopyError: Could not copy ''". self.str() ."'' to: '" . a:dest . "'"
endif
endfunction
@ -187,7 +191,7 @@ endfunction
"
"returns 1 if copying is supported for this OS
function! s:Path.CopyingSupported()
return exists('g:NERDTreeCopyCmd')
return exists('g:NERDTreeCopyCmd') || (exists('g:NERDTreeCopyDirCmd') && exists('g:NERDTreeCopyFileCmd'))
endfunction
"FUNCTION: Path.copyingWillOverwrite(dest) {{{1
@ -213,7 +217,7 @@ endfunction
"FUNCTION: Path.createParentDirectories(path) {{{1
"
"create parent directories for this path if needed
"without throwing any errors is those directories already exist
"without throwing any errors if those directories already exist
"
"Args:
"path: full path of the node whose parent directories may need to be created
@ -226,8 +230,7 @@ endfunction
"FUNCTION: Path.delete() {{{1
"
"Deletes the file represented by this path.
"Deletion of directories is not supported
"Deletes the file or directory represented by this path.
"
"Throws NERDTree.Path.Deletion exceptions
function! s:Path.delete()

View File

@ -117,28 +117,14 @@ endfunction
"FUNCTION: TreeDirNode.getCascade() {{{1
"Return an array of dir nodes (starting from self) that can be cascade opened.
function! s:TreeDirNode.getCascade()
if !self.isCascadable()
return [self]
endif
let rv = [self]
let node = self
let vc = self.getVisibleChildren()
let visChild = vc[0]
while 1
let vc = node.getVisibleChildren()
if len(vc) != 1
break
endif
let visChild = vc[0]
"TODO: optimize
if !visChild.path.isDirectory
break
endif
call add(rv, visChild)
let node = visChild
endwhile
return rv
return [self] + visChild.getCascade()
endfunction
"FUNCTION: TreeDirNode.getChildCount() {{{1
@ -264,6 +250,10 @@ endfunction
"FUNCTION: TreeDirNode.isCascadable() {{{1
"true if this dir has only one visible child - which is also a dir
function! s:TreeDirNode.isCascadable()
if g:NERDTreeCascadeSingleChildDir == 0
return 0
endif
let c = self.getVisibleChildren()
return len(c) == 1 && c[0].path.isDirectory
endfunction
@ -466,7 +456,7 @@ function! s:TreeDirNode.refresh()
" Regular expression is too expensive. Use simply string comparison
" instead
if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." &&
if i[len(i)-3:2] != ".." && i[len(i)-2:2] != ".." &&
\ i[len(i)-2:1] != "." && i[len(i)-1] != "."
try
"create a new path and see if it exists in this nodes children

View File

@ -282,7 +282,8 @@ endfunction
function! s:UI._indentLevelFor(line)
"have to do this work around because match() returns bytes, not chars
let numLeadBytes = match(a:line, '\M\[^ '.g:NERDTreeDirArrowExpandable.g:NERDTreeDirArrowCollapsible.']')
let leadChars = strchars(a:line[0:numLeadBytes-1])
" The next line is a backward-compatible workaround for strchars(a:line(0:numLeadBytes-1]). strchars() is in 7.3+
let leadChars = len(split(a:line[0:numLeadBytes-1], '\zs'))
return leadChars / s:UI.IndentWid()
endfunction