From 1b6c0cbfb66dd6827c4902bf340d3e53e710097a Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Sat, 21 Apr 2012 10:11:02 -0400 Subject: [PATCH] Improve cmd.exe shell escaping --- plugin/fugitive.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/fugitive.vim b/plugin/fugitive.vim index fe7d96e..aa087d9 100644 --- a/plugin/fugitive.vim +++ b/plugin/fugitive.vim @@ -29,8 +29,8 @@ endfunction function! s:shellesc(arg) abort if a:arg =~ '^[A-Za-z0-9_/.-]\+$' return a:arg - elseif &shell =~# 'cmd' && a:arg !~# '"' - return '"'.a:arg.'"' + elseif &shell =~# 'cmd' + return '"'.s:gsub(s:gsub(a:arg, '"', '""'), '\%', '"%"').'"' else return shellescape(a:arg) endif