mirror of
https://github.com/amix/vimrc
synced 2025-06-16 17:45:00 +08:00
Updated plugins
This commit is contained in:
@ -28,7 +28,9 @@ endfunction
|
||||
|
||||
" FUNCTION: s:Creator._broadcastInitEvent() {{{1
|
||||
function! s:Creator._broadcastInitEvent()
|
||||
silent doautocmd User NERDTreeInit
|
||||
if exists('#User#NERDTreeInit')
|
||||
doautocmd User NERDTreeInit
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: s:Creator.BufNamePrefix() {{{1
|
||||
@ -170,6 +172,7 @@ function! s:Creator.createMirror()
|
||||
let t:NERDTreeBufName = bufferName
|
||||
call self._createTreeWin()
|
||||
exec 'buffer ' . bufferName
|
||||
call b:NERDTree.ui.restoreScreenState()
|
||||
if !&hidden
|
||||
call b:NERDTree.render()
|
||||
endif
|
||||
@ -247,7 +250,7 @@ function! s:Creator._pathForString(str)
|
||||
|
||||
"hack to get an absolute path if a relative path is given
|
||||
if dir =~# '^\.'
|
||||
let dir = getcwd() . g:NERDTreePath.Slash() . dir
|
||||
let dir = getcwd() . nerdtree#slash() . dir
|
||||
endif
|
||||
|
||||
"hack to prevent removing slash if dir is the root of the file system.
|
||||
|
@ -27,7 +27,9 @@ function! s:NERDTree.changeRoot(node)
|
||||
call self.render()
|
||||
call self.root.putCursorHere(0, 0)
|
||||
|
||||
silent doautocmd User NERDTreeNewRoot
|
||||
if exists('#User#NERDTreeNewRoot')
|
||||
doautocmd User NERDTreeNewRoot
|
||||
endif
|
||||
endfunction
|
||||
|
||||
"FUNCTION: s:NERDTree.Close() {{{1
|
||||
|
@ -174,9 +174,8 @@ function! s:Opener._newSplit()
|
||||
|
||||
"resize the tree window if no other window was open before
|
||||
if onlyOneWin
|
||||
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
||||
call nerdtree#exec('wincmd p', 1)
|
||||
call nerdtree#exec('silent '. splitMode .' resize '. size, 1)
|
||||
call nerdtree#exec('silent '. splitMode .' resize '. g:NERDTreeWinSize, 1)
|
||||
call nerdtree#exec('wincmd p', 0)
|
||||
endif
|
||||
|
||||
|
@ -25,10 +25,10 @@ function! s:Path.AbsolutePathFor(pathStr)
|
||||
if l:prependWorkingDir
|
||||
let l:result = getcwd()
|
||||
|
||||
if l:result[-1:] ==# s:Path.Slash()
|
||||
if l:result[-1:] == nerdtree#slash()
|
||||
let l:result = l:result . a:pathStr
|
||||
else
|
||||
let l:result = l:result . s:Path.Slash() . a:pathStr
|
||||
let l:result = l:result . nerdtree#slash() . a:pathStr
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -99,50 +99,6 @@ function! s:Path.changeToDir()
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Path.compareTo() {{{1
|
||||
"
|
||||
" Compares this Path to the given path and returns 0 if they are equal, -1 if
|
||||
" this Path is 'less than' the given path, or 1 if it is 'greater'.
|
||||
"
|
||||
" Args:
|
||||
" path: the path object to compare this to
|
||||
"
|
||||
" Return:
|
||||
" 1, -1 or 0
|
||||
function! s:Path.compareTo(path)
|
||||
let thisPath = self.getLastPathComponent(1)
|
||||
let thatPath = a:path.getLastPathComponent(1)
|
||||
|
||||
"if the paths are the same then clearly we return 0
|
||||
if thisPath ==# thatPath
|
||||
return 0
|
||||
endif
|
||||
|
||||
let thisSS = self.getSortOrderIndex()
|
||||
let thatSS = a:path.getSortOrderIndex()
|
||||
|
||||
"compare the sort sequences, if they are different then the return
|
||||
"value is easy
|
||||
if thisSS < thatSS
|
||||
return -1
|
||||
elseif thisSS > thatSS
|
||||
return 1
|
||||
else
|
||||
if !g:NERDTreeSortHiddenFirst
|
||||
let thisPath = substitute(thisPath, '^[._]', '', '')
|
||||
let thatPath = substitute(thatPath, '^[._]', '', '')
|
||||
endif
|
||||
"if the sort sequences are the same then compare the paths
|
||||
"alphabetically
|
||||
let pathCompare = g:NERDTreeCaseSensitiveSort ? thisPath <# thatPath : thisPath <? thatPath
|
||||
if pathCompare
|
||||
return -1
|
||||
else
|
||||
return 1
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Path.Create(fullpath) {{{1
|
||||
"
|
||||
" Factory method.
|
||||
@ -614,23 +570,6 @@ function! s:Path.New(pathStr)
|
||||
return l:newPath
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Path.Slash() {{{1
|
||||
" 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! s:Path.Slash()
|
||||
|
||||
if nerdtree#runningWindows()
|
||||
if exists('+shellslash') && &shellslash
|
||||
return '/'
|
||||
endif
|
||||
|
||||
return '\'
|
||||
endif
|
||||
|
||||
return '/'
|
||||
endfunction
|
||||
|
||||
" FUNCTION: Path.Resolve() {{{1
|
||||
" Invoke the vim resolve() function and return the result
|
||||
" This is necessary because in some versions of vim resolve() removes trailing
|
||||
@ -815,7 +754,7 @@ function! s:Path._strForEdit()
|
||||
|
||||
" On Windows, the drive letter may be removed by "fnamemodify()". Add it
|
||||
" back, if necessary.
|
||||
if nerdtree#runningWindows() && l:result[0] ==# s:Path.Slash()
|
||||
if nerdtree#runningWindows() && l:result[0] == nerdtree#slash()
|
||||
let l:result = self.drive . l:result
|
||||
endif
|
||||
|
||||
@ -830,14 +769,14 @@ endfunction
|
||||
|
||||
" FUNCTION: Path._strForGlob() {{{1
|
||||
function! s:Path._strForGlob()
|
||||
let lead = s:Path.Slash()
|
||||
let lead = nerdtree#slash()
|
||||
|
||||
"if we are running windows then slap a drive letter on the front
|
||||
if nerdtree#runningWindows()
|
||||
let lead = self.drive . '\'
|
||||
endif
|
||||
|
||||
let toReturn = lead . join(self.pathSegments, s:Path.Slash())
|
||||
let toReturn = lead . join(self.pathSegments, nerdtree#slash())
|
||||
|
||||
if !nerdtree#runningWindows()
|
||||
let toReturn = escape(toReturn, self._escChars())
|
||||
@ -849,7 +788,7 @@ endfunction
|
||||
" Return the absolute pathname associated with this Path object. The pathname
|
||||
" returned is appropriate for the underlying file system.
|
||||
function! s:Path._str()
|
||||
let l:separator = s:Path.Slash()
|
||||
let l:separator = nerdtree#slash()
|
||||
let l:leader = l:separator
|
||||
|
||||
if nerdtree#runningWindows()
|
||||
|
@ -236,7 +236,7 @@ function! s:TreeDirNode.getChildIndex(path)
|
||||
let z = self.getChildCount()
|
||||
while a < z
|
||||
let mid = (a+z)/2
|
||||
let diff = a:path.compareTo(self.children[mid].path)
|
||||
let diff = nerdtree#compareNodePaths(a:path, self.children[mid].path)
|
||||
|
||||
if diff ==# -1
|
||||
let z = mid
|
||||
@ -278,8 +278,8 @@ function! s:TreeDirNode._glob(pattern, all)
|
||||
else
|
||||
let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',')
|
||||
|
||||
" On Windows, the drive letter may be removed by fnamemodify().
|
||||
if nerdtree#runningWindows() && l:pathSpec[0] ==# g:NERDTreePath.Slash()
|
||||
" On Windows, the drive letter may be removed by "fnamemodify()".
|
||||
if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash()
|
||||
let l:pathSpec = self.path.drive . l:pathSpec
|
||||
endif
|
||||
endif
|
||||
@ -666,7 +666,7 @@ function! s:TreeDirNode.sortChildren()
|
||||
if count(g:NERDTreeSortOrder, '*') < 1
|
||||
call add(g:NERDTreeSortOrder, '*')
|
||||
endif
|
||||
let CompareFunc = function('nerdtree#compareNodesBySortKey')
|
||||
let CompareFunc = function('nerdtree#compareNodes')
|
||||
call sort(self.children, CompareFunc)
|
||||
let g:NERDTreeOldSortOrder = g:NERDTreeSortOrder
|
||||
endfunction
|
||||
|
@ -67,6 +67,10 @@ function! s:UI._dumpHelp()
|
||||
let help .= '" '. g:NERDTreeMapPreview .": find dir in tree\n"
|
||||
let help .= '" '. g:NERDTreeMapOpenInTab.": open in new tab\n"
|
||||
let help .= '" '. g:NERDTreeMapOpenInTabSilent .": open in new tab silently\n"
|
||||
let help .= '" '. g:NERDTreeMapOpenSplit .": open split\n"
|
||||
let help .= '" '. g:NERDTreeMapPreviewSplit .": preview split\n"
|
||||
let help .= '" '. g:NERDTreeMapOpenVSplit .": open vsplit\n"
|
||||
let help .= '" '. g:NERDTreeMapPreviewVSplit .": preview vsplit\n"
|
||||
let help .= '" '. g:NERDTreeMapCustomOpen .": custom open\n"
|
||||
let help .= '" '. g:NERDTreeMapDeleteBookmark .": delete bookmark\n"
|
||||
|
||||
@ -364,7 +368,7 @@ function! s:UI.saveScreenState()
|
||||
call g:NERDTree.CursorToTreeWin()
|
||||
let self._screenState['oldPos'] = getpos('.')
|
||||
let self._screenState['oldTopLine'] = line('w0')
|
||||
let self._screenState['oldWindowSize']= winwidth('')
|
||||
let self._screenState['oldWindowSize'] = winnr('$')==1 ? g:NERDTreeWinSize : winwidth('')
|
||||
call nerdtree#exec(win . 'wincmd w', 1)
|
||||
catch
|
||||
endtry
|
||||
@ -512,8 +516,7 @@ endfunction
|
||||
" zoom (maximize/minimize) the NERDTree window
|
||||
function! s:UI.toggleZoom()
|
||||
if exists('b:NERDTreeZoomed') && b:NERDTreeZoomed
|
||||
let size = exists('b:NERDTreeOldWindowSize') ? b:NERDTreeOldWindowSize : g:NERDTreeWinSize
|
||||
call nerdtree#exec('silent vertical resize '. size, 1)
|
||||
call nerdtree#exec('silent vertical resize '. g:NERDTreeWinSize, 1)
|
||||
let b:NERDTreeZoomed = 0
|
||||
else
|
||||
call nerdtree#exec('vertical resize '. get(g:, 'NERDTreeWinSizeMax', ''), 1)
|
||||
|
Reference in New Issue
Block a user