From 63e689b64798b0d4cfdcfbea47570b6421b97abe Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Tue, 11 Sep 2012 17:44:14 +1200 Subject: [PATCH] Escape all cmd.exe reserved chars --- autoload/tagbar.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 421855c..67a5ee4 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -3154,7 +3154,12 @@ function! s:EscapeCtagsCmd(ctags_bin, args, ...) abort " Stupid cmd.exe quoting if &shell =~ 'cmd\.exe' - let ctags_cmd = substitute(ctags_cmd, '\(&\|\^\)', '^\0', 'g') + let reserved_chars = '&()@^' + " not allowed in filenames, but escape anyway just in case + let reserved_chars .= '<>|' + let pattern = join(split(reserved_chars, '\zs'), '\|') + let ctags_cmd = substitute(ctags_cmd, '\V\(' . pattern . '\)', + \ '^\0', 'g') endif if exists('+shellslash')