vim-makejob

Minimal, asynchronous quickfix commands for Vim 8.0
git clone git://git.danielmoch.com/vim-makejob.git
Log | Files | Refs | README | LICENSE

commit 02c246e7034b06daf25fb719766cd652460f64b4
parent d043ec66e9647764155e845aa6932f2db83f8ca5
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Thu,  8 Dec 2016 18:34:07 -0500

Escape command in Windows

Diffstat:
Mplugin/makejob.vim | 20+++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/plugin/makejob.vim b/plugin/makejob.vim @@ -90,6 +90,22 @@ function! s:Expand(input) return join(l:expanded_input) endfunction +" Credit to Tim Pope for the magic here +function! s:Escape(str) + if has('win32') || has('win64') + if &shellxquote ==# '"' + return '"' . substitute(a:str, '"', '""', 'g') . '"' + else + let l:esc = exists('+shellxescape') ? &shellxescape : '"&|<>()@^' + return &shellxquote . + \ substitute(a:str, '['.l:esc.']', '^&', 'g') . + \ get({'(': ')', '"(': ')"'}, &shellxquote, &shellxquote) + endif + else + return a:str + endif +endfunction + function! s:MakeJob(grep, lmake, grepadd, bang, ...) let l:make = a:grep ? s:Expand(&grepprg) : s:Expand(&makeprg) let l:prog = split(l:make)[0] @@ -119,9 +135,7 @@ function! s:MakeJob(grep, lmake, grepadd, bang, ...) let l:make = l:make.' '.l:arg endif - if a:grep - let l:make = [&shell, &shellcmdflag, l:make] - endif + let l:make = [&shell, &shellcmdflag, s:Escape(l:make)] endif let l:opts = { 'close_cb' : function('s:JobHandler'),