mirror of
https://github.com/amix/vimrc
synced 2025-06-16 09:35:01 +08:00
Updated plugins
This commit is contained in:
@ -1,4 +1,16 @@
|
||||
Next
|
||||
- Shorten delete confimration of empty directory to 'y' (mikeperri) #530
|
||||
- Fix API call to open directory tree in window (devm33) #533
|
||||
- Change default arrows on non-Windows platforms (gwilk) #546
|
||||
- Update to README - combine cd and git clone (zwhitchcox) #584
|
||||
- Update to README - Tip: start NERDTree when vim starts (therealplato) #593
|
||||
- Escape filename when moving an open buffer (zacharyvoase) #595
|
||||
- Fixed incorrect :helptags command in README (curran) #619
|
||||
- Fixed incomplete escaping of folder arrows (adityanatraj) #548
|
||||
- Added NERDTreeCascadeSingleChildDir option (juanibiapina) #558
|
||||
- Replace strchars() with backward compatible workaround.
|
||||
- Add support for copy command in Windows (SkylerLipthay) #231
|
||||
- Fixed typo in README.markdown - :Helptags -> :helptags
|
||||
- Rename "primary" and "secondary" trees to "tab" and "window" trees.
|
||||
- Move a bunch of buffer level variables into the NERDTree and UI classes.
|
||||
- Display cascading dirs on one line to save vertical/horizontal space (@matt-gardner: brainstorming/testing)
|
||||
|
@ -57,10 +57,9 @@ Installation
|
||||
|
||||
####[pathogen.vim](https://github.com/tpope/vim-pathogen)
|
||||
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/scrooloose/nerdtree.git
|
||||
git clone https://github.com/scrooloose/nerdtree.git ~/.vim/bundle/nerdtree
|
||||
|
||||
Then reload vim, run `:Helptags`, and check out `:help NERD_tree.txt`.
|
||||
Then reload vim, run `:helptags ~/.vim/bundle/nerdtree/doc/`, and check out `:help NERD_tree.txt`.
|
||||
|
||||
|
||||
####[apt-vim](https://github.com/egalpin/apt-vim)
|
||||
@ -101,6 +100,16 @@ Stick this in your vimrc:
|
||||
|
||||
Note: Now start vim with plain `vim`, not `vim .`
|
||||
|
||||
---
|
||||
> How can I open NERDTree on startup, and have my cursor start in the other window?
|
||||
|
||||
Stick this in your vimrc:
|
||||
|
||||
autocmd vimenter * NERDTree
|
||||
autocmd vimenter * wincmd p
|
||||
|
||||
*via [stackoverflow/Yohann](http://stackoverflow.com/questions/4277808/nerdtree-auto-focus-to-file-when-opened-in-new-tab/19330023#19330023)*
|
||||
|
||||
---
|
||||
> How can I map a specific key or shortcut to open NERDTree?
|
||||
|
||||
@ -125,5 +134,5 @@ See here: https://github.com/scrooloose/nerdtree/issues/433#issuecomment-9259069
|
||||
|
||||
Use these variables in your vimrc. Note that below are default arrow symbols
|
||||
|
||||
let g:NERDTreeDirArrowExpandable = '▸'
|
||||
let g:NERDTreeDirArrowCollapsible = '▾'
|
||||
let g:NERDTreeDirArrowExpandable = '►'
|
||||
let g:NERDTreeDirArrowCollapsible = '▼'
|
||||
|
@ -668,14 +668,18 @@ NERD tree. These options should be set in your vimrc.
|
||||
|'NERDTreeWinSize'| Sets the window size when the NERD tree is
|
||||
opened.
|
||||
|
||||
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||
|'NERDTreeMinimalUI'| Disables display of the 'Bookmarks' label and
|
||||
'Press ? for help' text.
|
||||
|
||||
|'NERDTreeCascadeSingleChildDir'|
|
||||
Collapses on the same line directories that
|
||||
have only one child directory.
|
||||
|
||||
|'NERDTreeCascadeOpenSingleChildDir'|
|
||||
Cascade open while selected directory has only
|
||||
one child that also is a directory.
|
||||
|
||||
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
|
||||
|'NERDTreeAutoDeleteBuffer'| Tells the NERD tree to automatically remove
|
||||
a buffer when a file is being deleted or renamed
|
||||
via a context menu command.
|
||||
|
||||
@ -987,7 +991,18 @@ of the following lines to set this option: >
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCascadeOpenSingleChildDir'*
|
||||
*'NERDTreeCascadeSingleChildDir'*
|
||||
Values: 0 or 1
|
||||
Default: 1.
|
||||
|
||||
When displaying dir nodes, this option tells NERDTree to collapse dirs that
|
||||
have only one child. Use one of the follow lines to set this option: >
|
||||
let NERDTreeCascadeSingleChildDir=0
|
||||
let NERDTreeCascadeSingleChildDir=1
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeCascadeOpenSingleChildDir'*
|
||||
Values: 0 or 1
|
||||
Default: 1.
|
||||
|
||||
@ -1001,7 +1016,7 @@ useful for Java projects. Use one of the follow lines to set this option: >
|
||||
<
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
*'NERDTreeAutoDeleteBuffer'*
|
||||
*'NERDTreeAutoDeleteBuffer'*
|
||||
Values: 0 or 1
|
||||
Default: 0.
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -74,7 +74,7 @@ endfunction
|
||||
function! s:promptToRenameBuffer(bufnum, msg, newFileName)
|
||||
echo a:msg
|
||||
if g:NERDTreeAutoDeleteBuffer || nr2char(getchar()) ==# 'y'
|
||||
let quotedFileName = "'" . a:newFileName . "'"
|
||||
let quotedFileName = fnameescape(a:newFilename)
|
||||
" 1. ensure that a new buffer is loaded
|
||||
exec "badd " . quotedFileName
|
||||
" 2. ensure that all windows which display the just deleted filename
|
||||
@ -160,10 +160,10 @@ function! NERDTreeDeleteNode()
|
||||
let currentNode = g:NERDTreeFileNode.GetSelected()
|
||||
let confirmed = 0
|
||||
|
||||
if currentNode.path.isDirectory
|
||||
if currentNode.path.isDirectory && currentNode.getChildCount() > 0
|
||||
let choice =input("Delete the current node\n" .
|
||||
\ "==========================================================\n" .
|
||||
\ "STOP! To delete this entire directory, type 'yes'\n" .
|
||||
\ "STOP! Directory is not empty! To delete, type 'yes'\n" .
|
||||
\ "" . currentNode.path.str() . ": ")
|
||||
let confirmed = choice ==# 'yes'
|
||||
else
|
||||
|
@ -68,13 +68,14 @@ call s:initVariable("g:NERDTreeShowLineNumbers", 0)
|
||||
call s:initVariable("g:NERDTreeSortDirs", 1)
|
||||
|
||||
if !nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "▸")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▾")
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "►")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "▼")
|
||||
else
|
||||
call s:initVariable("g:NERDTreeDirArrowExpandable", "+")
|
||||
call s:initVariable("g:NERDTreeDirArrowCollapsible", "~")
|
||||
endif
|
||||
call s:initVariable("g:NERDTreeCascadeOpenSingleChildDir", 1)
|
||||
call s:initVariable("g:NERDTreeCascadeSingleChildDir", 1)
|
||||
|
||||
if !exists("g:NERDTreeSortOrder")
|
||||
let g:NERDTreeSortOrder = ['\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
@ -103,6 +104,8 @@ call s:initVariable("g:NERDTreeWinSize", 31)
|
||||
"Note: the space after the command is important
|
||||
if nerdtree#runningWindows()
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rmdir /s /q ')
|
||||
call s:initVariable("g:NERDTreeCopyDirCmd", 'xcopy /s /e /i /y /q ')
|
||||
call s:initVariable("g:NERDTreeCopyFileCmd", 'copy /y ')
|
||||
else
|
||||
call s:initVariable("g:NERDTreeRemoveDirCmd", 'rm -rf ')
|
||||
call s:initVariable("g:NERDTreeCopyCmd", 'cp -r ')
|
||||
|
@ -25,7 +25,7 @@ syn match NERDTreeDirSlash #/# containedin=NERDTreeDir
|
||||
exec 'syn match NERDTreeClosable #'.escape(g:NERDTreeDirArrowCollapsible, '~').'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
exec 'syn match NERDTreeOpenable #'.escape(g:NERDTreeDirArrowExpandable, '~').'# containedin=NERDTreeDir,NERDTreeFile'
|
||||
|
||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~').escape(g:NERDTreeDirArrowExpandable, '~')
|
||||
let s:dirArrows = escape(g:NERDTreeDirArrowCollapsible, '~]\-').escape(g:NERDTreeDirArrowExpandable, '~]\-')
|
||||
exec 'syn match NERDTreeDir #[^'.s:dirArrows.' ].*/#'
|
||||
syn match NERDTreeExecFile #^ .*\*\($\| \)# contains=NERDTreeRO,NERDTreeBookmark
|
||||
exec 'syn match NERDTreeFile #^[^"\.'.s:dirArrows.'] *[^'.s:dirArrows.']*# contains=NERDTreeLink,NERDTreeRO,NERDTreeBookmark,NERDTreeExecFile'
|
||||
|
Reference in New Issue
Block a user