From bb12f7998d0135d4d5080f4316b99e9d8124135c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 3 Aug 2019 18:23:26 -0400 Subject: [PATCH] Use powershell '&' to run escaped batchfile --- plug.vim | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plug.vim b/plug.vim index 66ef95e..2e1580d 100644 --- a/plug.vim +++ b/plug.vim @@ -810,6 +810,9 @@ function! s:bang(cmd, ...) let batchfile = tempname().'.bat' call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = s:shellesc(batchfile, &shell) + if &shell =~# 'powershell\.exe$' + let cmd = '& ' . cmd + endif endif let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%') execute "normal! :execute g:_plug_bang\\" @@ -2036,6 +2039,9 @@ function! s:system(cmd, ...) let batchfile = tempname().'.bat' call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = s:shellesc(batchfile, &shell) + if &shell =~# 'powershell\.exe$' + let cmd = '& ' . cmd + endif endif return system(cmd) finally @@ -2370,6 +2376,9 @@ function! s:preview_commit() let batchfile = tempname().'.bat' call writefile(["@echo off\r", cmd . "\r"], batchfile) let cmd = s:shellesc(batchfile, &shell) + if &shell =~# 'powershell\.exe$' + let cmd = '& ' . cmd + endif endif execute 'silent %!' cmd finally