From 9184ec05bd9def72de1ace14c9421b97f4f858dd Mon Sep 17 00:00:00 2001 From: Kai <57713705+kai-patel@users.noreply.github.com> Date: Sun, 22 Oct 2023 15:28:09 +0100 Subject: [PATCH] fix: escape directories containing brackets([...]) for globbing (#1359) --- lib/nerdtree/tree_dir_node.vim | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/nerdtree/tree_dir_node.vim b/lib/nerdtree/tree_dir_node.vim index 6ed1ea8..7edc50f 100644 --- a/lib/nerdtree/tree_dir_node.vim +++ b/lib/nerdtree/tree_dir_node.vim @@ -278,6 +278,10 @@ function! s:TreeDirNode._glob(pattern, all) else let l:pathSpec = escape(fnamemodify(self.path.str({'format': 'Glob'}), ':.'), ',') + if nerdtree#runningWindows() + let l:pathSpec = substitute(l:pathSpec, "\\[\\(.*\\]\\)", "[[]\\1", "g") + endif + " On Windows, the drive letter may be removed by "fnamemodify()". if nerdtree#runningWindows() && l:pathSpec[0] == nerdtree#slash() let l:pathSpec = self.path.drive . l:pathSpec