Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa authored Oct 19, 2023
2 parents 9de3e95 + d69b68b commit 6085d09
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/vint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v3
- name: Run vint with reviewdog
uses: reviewdog/action-vint@v1.0.1
uses: reviewdog/action-vint@v1
with:
github_token: ${{ secrets.github_token }}
reporter: github-pr-review
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,21 @@
PATCH versions are listed from newest to oldest under their respective MAJOR.MINOR
version in an unordered list. The format is:
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
or
- **.PATCH**:
- Pull Request Title 1 (PR Author) [PR Number](Link to PR)
- Pull Request Title 2 (PR Author) [PR Number](Link to PR)
.
.
.
- Pull Request Title n (PR Author) [PR Number](Link to PR)
-->
#### 7.0
- **.0**:
- Now we warn about invalid files instead of ignoring them silently. (rmonico) [#1365](https://github.com/preservim/nerdtree/pull/1365)
- New g:NERDTreeWinPos options for top and bottom. (rzvxa) [#1363](https://github.com/preservim/nerdtree/pull/1363)
- Fix error in README. (nickspoons) [#1330](https://github.com/preservim/nerdtree/pull/1330)
- Fix typo in the documentation. (chapeupreto) [#1306](https://github.com/preservim/nerdtree/pull/1306)
#### 6.10
- **.16**: Fix documentation errors. (lifecrisis) [#1269](https://github.com/preservim/nerdtree/pull/1269)
- **.15**: Ensure backward compatible testing of types. (lifecrisis) [#1266](https://github.com/preservim/nerdtree/pull/1266)
Expand Down
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,15 @@ autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTa
```vim
" If another buffer tries to replace NERDTree, put it in the other window, and bring back NERDTree.
autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
autocmd BufEnter * if winnr() == winnr('h') && bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_tree_\d\+' && winnr('$') > 1 |
\ let buf=bufnr() | buffer# | execute "normal! \<C-W>w" | execute 'buffer'.buf | endif
```
### Can I have the same NERDTree on every tab automatically?
```vim
" 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:
```vim
Expand Down
9 changes: 8 additions & 1 deletion doc/NERDTree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ setting is used.

------------------------------------------------------------------------------
*NERDTreeWinPos*
Values: "left" or "right"
Values: "left", "right", "top" or "bottom"
Default: "left".

This setting is used to determine where NERDTree window is placed on the
Expand All @@ -1138,6 +1138,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
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*
Values: a positive integer.
Expand Down
9 changes: 5 additions & 4 deletions lib/nerdtree/creator.vim
Original file line number Diff line number Diff line change
Expand Up @@ -182,16 +182,17 @@ endfunction
" Initialize the NERDTree window. Open the window, size it properly, set all
" local options, etc.
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

if !g:NERDTree.ExistsForTab()
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 'vertical resize '. l:splitSize
silent! execute l:splitDirection . ' resize '. l:splitSize
else
silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
silent! execute l:splitLocation . l:splitDirection . ' ' . l:splitSize . ' split'
silent! execute 'buffer ' . t:NERDTreeBufName
endif

Expand Down
10 changes: 7 additions & 3 deletions lib/nerdtree/tree_dir_node.vim
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,15 @@ function! s:TreeDirNode._initChildren(silent)
endif

let invalidFilesFound = 0
let invalidFiles = []
for i in files
try
let path = g:NERDTreePath.New(i)
call self.createChild(path, 0)
call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
let invalidFilesFound += 1
let invalidFiles += [i]
endtry
endfor

Expand All @@ -437,7 +439,7 @@ function! s:TreeDirNode._initChildren(silent)
call nerdtree#echo('')

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
return self.getChildCount()
endfunction
Expand Down Expand Up @@ -564,6 +566,7 @@ function! s:TreeDirNode.refresh()
let files = self._glob('*', 1) + self._glob('.*', 0)
let newChildNodes = []
let invalidFilesFound = 0
let invalidFiles = []
for i in files
try
"create a new path and see if it exists in this nodes children
Expand All @@ -580,7 +583,8 @@ function! s:TreeDirNode.refresh()
call add(newChildNodes, newNode)
endif
catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
let invalidFilesFound = 1
let invalidFilesFound += 1
let invalidFiles += [i]
endtry
endfor

Expand All @@ -589,7 +593,7 @@ function! s:TreeDirNode.refresh()
call self.sortChildren()

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
endfunction
Expand Down
2 changes: 1 addition & 1 deletion syntax/nerdtree.vim
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else
hi! link NERDTreeNodeDelimiters Ignore
endif

"highlighing for directory nodes and file nodes
"highlighting for directory nodes and file nodes
syn match NERDTreeDirSlash #/# containedin=NERDTreeDir

if g:NERDTreeDirArrowExpandable !=# ''
Expand Down

0 comments on commit 6085d09

Please sign in to comment.