From dc6546e5ec87ab0e98b85c43b0f81d660a77a970 Mon Sep 17 00:00:00 2001 From: Rafael Monico Date: Fri, 8 Oct 2021 19:47:20 -0300 Subject: [PATCH 1/2] Warn about invalid files not loaded on-load Co-authored-by: rzvxa --- lib/nerdtree/tree_dir_node.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim index f5f76829..05d93627 100644 --- 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 From cfce0d1739c1c3b9181e78e02dc95689aa63c9ba Mon Sep 17 00:00:00 2001 From: rzvxa Date: Sun, 3 Sep 2023 03:01:39 +0330 Subject: [PATCH 2/2] Warn about invalid files not loaded on-refresh --- lib/nerdtree/tree_dir_node.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim index 05d93627..6ed1ea84 100644 --- a/lib/nerdtree/tree_dir_node.vim +++ b/lib/nerdtree/tree_dir_node.vim @@ -566,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 @@ -582,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 @@ -591,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