nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 6085d09dd69bc996380e661f5d0cd7d117f65eb4
parent 9de3e950fc52ed09dfe9e9ed31287a8cf4ef2d33
Author: Ali Rezvani <3788964+rzvxa@users.noreply.github.com>
Date:   Thu, 19 Oct 2023 15:51:40 +0330

Merge branch 'master' into master
Diffstat:
M.github/workflows/vint.yml | 4++--
MCHANGELOG.md | 14++++++++++++++
MREADME.markdown | 4++--
Mdoc/NERDTree.txt | 9++++++++-
Mlib/nerdtree/creator.vim | 9+++++----
Mlib/nerdtree/tree_dir_node.vim | 10+++++++---
Msyntax/nerdtree.vim | 2+-
7 files changed, 39 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/vint.yml b/.github/workflows/vint.yml
@@ -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
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -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)
diff --git a/README.markdown b/README.markdown
@@ -170,7 +170,7 @@ 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
 ```
 
@@ -178,7 +178,7 @@ autocmd BufEnter * if bufname('#') =~ 'NERD_tree_\d\+' && bufname('%') !~ 'NERD_
 
 ```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
diff --git a/doc/NERDTree.txt b/doc/NERDTree.txt
@@ -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
@@ -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.
diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim
@@ -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
 
diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim
@@ -421,6 +421,7 @@ function! s:TreeDirNode._initChildren(silent)
     endif
 
     let invalidFilesFound = 0
+    let invalidFiles = []
     for i in files
         try
             let path = g:NERDTreePath.New(i)
@@ -428,6 +429,7 @@ function! s:TreeDirNode._initChildren(silent)
             call g:NERDTreePathNotifier.NotifyListeners('init', path, self.getNerdtree(), {})
         catch /^NERDTree.\(InvalidArguments\|InvalidFiletype\)Error/
             let invalidFilesFound += 1
+            let invalidFiles += [i]
         endtry
     endfor
 
@@ -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
@@ -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
@@ -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
 
@@ -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
diff --git a/syntax/nerdtree.vim b/syntax/nerdtree.vim
@@ -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 !=# ''