Skip to content

Commit

Permalink
Windows working now
Browse files Browse the repository at this point in the history
Docs for jab_start actually recommend passing the command as a string in
Windows and a list in Unix. Go figure.
  • Loading branch information
djmoch committed Dec 8, 2016
1 parent 02c246e commit 4b53b99
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions plugin/makejob.vim
Original file line number Diff line number Diff line change
Expand Up @@ -90,22 +90,6 @@ 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]
Expand Down Expand Up @@ -135,7 +119,9 @@ function! s:MakeJob(grep, lmake, grepadd, bang, ...)
let l:make = l:make.' '.l:arg
endif

let l:make = [&shell, &shellcmdflag, s:Escape(l:make)]
if !has('win32') && !has('win64')
let l:make = [&shell, &shellcmdflag, l:make]
endif
endif

let l:opts = { 'close_cb' : function('s:JobHandler'),
Expand Down

0 comments on commit 4b53b99

Please sign in to comment.