commit 0caa46685451096201ff949c11fd208bc54c6050
parent 45f4d61f04e7ef33360f7735931da9ea2ebc05e0
Author: Jason Cheatham <j.cheatham@gmail.com>
Date: Fri, 17 Mar 2017 11:53:09 -0400
Use relative path with globpath
Wildignore rules that involve directories aren't handled properly (or at
least as one might expect) when globpath uses absolute paths. For
example, when wildignore contains `src/*.js`, `globpath("src", "*")`
works as expected, while `globpath("/home/user/project/src", "*")`
doesn't.
Diffstat:
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim
@@ -272,7 +272,9 @@ function! s:TreeDirNode._initChildren(silent)
"get an array of all the files in the nodes dir
let dir = self.path
- let globDir = dir.str({'format': 'Glob'})
+
+ "use a relative globDir so that relative wildignore rules will be obeyed
+ let globDir = fnamemodify(dir.str({'format': 'Glob'}), ':.')
if version >= 703
let filesStr = globpath(globDir, '*', !g:NERDTreeRespectWildIgnore) . "\n" . globpath(globDir, '.*', !g:NERDTreeRespectWildIgnore)
@@ -445,7 +447,7 @@ function! s:TreeDirNode.refresh()
let newChildNodes = []
let invalidFilesFound = 0
let dir = self.path
- let globDir = dir.str({'format': 'Glob'})
+ let globDir = fnamemodify(dir.str({'format': 'Glob'}), ':.')
let filesStr = globpath(globDir, '*') . "\n" . globpath(globDir, '.*')
let files = split(filesStr, "\n")
for i in files