mirror of
https://github.com/preservim/nerdtree.git
synced 2024-10-18 13:50:21 +03:00
Merge branch 'master' of https://github.com/preservim/nerdtree
This commit is contained in:
commit
0c9517d8ef
@ -178,7 +178,7 @@ autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_
|
|||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Open the existing NERDTree on each new tab.
|
" Open the existing NERDTree on each new tab.
|
||||||
autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror | endif
|
autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif
|
||||||
```
|
```
|
||||||
or change your NERDTree-launching shortcut key like so:
|
or change your NERDTree-launching shortcut key like so:
|
||||||
```vim
|
```vim
|
||||||
|
@ -1130,7 +1130,7 @@ setting is used.
|
|||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeWinPos*
|
*NERDTreeWinPos*
|
||||||
Values: "left" or "right"
|
Values: "left", "right", "top" or "bottom"
|
||||||
Default: "left".
|
Default: "left".
|
||||||
|
|
||||||
This setting is used to determine where NERDTree window is placed on the
|
This setting is used to determine where NERDTree window is placed on the
|
||||||
@ -1140,6 +1140,13 @@ This setting makes it possible to use two different explorer plugins
|
|||||||
simultaneously. For example, you could have the taglist plugin on the left of
|
simultaneously. For example, you could have the taglist plugin on the left of
|
||||||
the window and the NERDTree on the right.
|
the window and the NERDTree on the right.
|
||||||
|
|
||||||
|
When setting this variable to "top" or "bottom" make sure to also change the
|
||||||
|
|NERDTreeWinSize| to a more reasonable size.
|
||||||
|
|
||||||
|
For example:
|
||||||
|
>
|
||||||
|
let g:NERDTreeWinSize = 15
|
||||||
|
<
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
*NERDTreeWinSize*
|
*NERDTreeWinSize*
|
||||||
Values: a positive integer.
|
Values: a positive integer.
|
||||||
|
@ -182,16 +182,17 @@ endfunction
|
|||||||
" Initialize the NERDTree window. Open the window, size it properly, set all
|
" Initialize the NERDTree window. Open the window, size it properly, set all
|
||||||
" local options, etc.
|
" local options, etc.
|
||||||
function! s:Creator._createTreeWin()
|
function! s:Creator._createTreeWin()
|
||||||
let l:splitLocation = g:NERDTreeWinPos ==# 'left' ? 'topleft ' : 'botright '
|
let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright '
|
||||||
|
let l:splitDirection = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'right' ? 'vertical' : ''
|
||||||
let l:splitSize = g:NERDTreeWinSize
|
let l:splitSize = g:NERDTreeWinSize
|
||||||
|
|
||||||
if !g:NERDTree.ExistsForTab()
|
if !g:NERDTree.ExistsForTab()
|
||||||
let t:NERDTreeBufName = self._nextBufferName()
|
let t:NERDTreeBufName = self._nextBufferName()
|
||||||
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
|
silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' new'
|
||||||
silent! execute 'edit ' . t:NERDTreeBufName
|
silent! execute 'edit ' . t:NERDTreeBufName
|
||||||
silent! execute 'vertical resize '. l:splitSize
|
silent! execute l:splitDirection . ' resize '. l:splitSize
|
||||||
else
|
else
|
||||||
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
|
silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' split'
|
||||||
silent! execute 'buffer ' . t:NERDTreeBufName
|
silent! execute 'buffer ' . t:NERDTreeBufName
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -422,6 +422,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let invalidFilesFound = 0
|
let invalidFilesFound = 0
|
||||||
|
let invalidFiles = []
|
||||||
for i in files
|
for i in files
|
||||||
try
|
try
|
||||||
let path = g:NERDTreePath.New(i)
|
let path = g:NERDTreePath.New(i)
|
||||||
@ -429,6 +430,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
|
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
|
||||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||||
let invalidFilesFound += 1
|
let invalidFilesFound += 1
|
||||||
|
let invalidFiles += [i]
|
||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -438,7 +440,7 @@ function! s:TreeDirNode._initChildren(silent)
|
|||||||
call nerdtree#echo('')
|
call nerdtree#echo('')
|
||||||
|
|
||||||
if invalidFilesFound
|
if invalidFilesFound
|
||||||
call nerdtree#echoWarning(invalidFilesFound . ' file(s) could not be loaded into the NERD tree')
|
call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', '))
|
||||||
endif
|
endif
|
||||||
return self.getChildCount()
|
return self.getChildCount()
|
||||||
endfunction
|
endfunction
|
||||||
@ -580,6 +582,7 @@ function! s:TreeDirNode.refresh(...)
|
|||||||
let files = self._glob('*', 1) + self._glob('.*', 0)
|
let files = self._glob('*', 1) + self._glob('.*', 0)
|
||||||
let newChildNodes = []
|
let newChildNodes = []
|
||||||
let invalidFilesFound = 0
|
let invalidFilesFound = 0
|
||||||
|
let invalidFiles = []
|
||||||
for i in files
|
for i in files
|
||||||
try
|
try
|
||||||
"create a new path and see if it exists in this nodes children
|
"create a new path and see if it exists in this nodes children
|
||||||
@ -596,7 +599,8 @@ function! s:TreeDirNode.refresh(...)
|
|||||||
call add(newChildNodes, newNode)
|
call add(newChildNodes, newNode)
|
||||||
endif
|
endif
|
||||||
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
|
||||||
let invalidFilesFound = 1
|
let invalidFilesFound += 1
|
||||||
|
let invalidFiles += [i]
|
||||||
endtry
|
endtry
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
@ -605,7 +609,7 @@ function! s:TreeDirNode.refresh(...)
|
|||||||
call self.sortChildren()
|
call self.sortChildren()
|
||||||
|
|
||||||
if invalidFilesFound
|
if invalidFilesFound
|
||||||
call nerdtree#echoWarning('some files could not be loaded into the NERD tree')
|
call nerdtree#echoWarning(invalidFilesFound . ' Invalid file(s): ' . join(invalidFiles, ', '))
|
||||||
endif
|
endif
|
||||||
let self.lazyRefresh = 0
|
let self.lazyRefresh = 0
|
||||||
" if this node is not empty and NERDTreeLazyDirRefresh is enable flag the node for lazyRefresh
|
" if this node is not empty and NERDTreeLazyDirRefresh is enable flag the node for lazyRefresh
|
||||||
|
Loading…
Reference in New Issue
Block a user