asyncrun.vim
asyncrun.vim copied to clipboard
Does not work with Powershell in Windows
When a different shell is configured on Windows (for example, Powershell), some of the shell power is lost using the .cmd approach.
https://github.com/skywind3000/asyncrun.vim/blob/master/plugin/asyncrun.vim#L582
let l:tmp = fnamemodify(tempname(), ':h') . '\asyncrun.cmd'
let l:run = ['@echo off', a:cmd]
call writefile(l:run, l:tmp)
let l:args += [l:tmp]
for example:
:! 1+1
works with Powershell configured, but
:AsyncRun 1+1
does not work, because it is not a valid .cmd syntax. I have made a simple change in my asyncrun.vim that enables me to work with any powershell expression:
let l:run = [&shell . " " . a:cmd]
Please let me know if you have any other suggestion to makes this work, or need help to implement this.
My guess is it has something to do with g:asyncrun_shell. Maybe try setting that to whatever shell you want to use.
https://github.com/skywind3000/asyncrun.vim/blob/master/plugin/asyncrun.vim#L561
I've been reading through the script a lot today. Let me know if that helps!
EDIT: Looks like something similar was asked? -> #53
EDIT 2:
Ok I see where it happens.
https://github.com/skywind3000/asyncrun.vim/blob/master/plugin/asyncrun.vim#L582
Maybe rewrite this part so that it works in powershell, test it on a fresh install and submit a PR. Not sure how receptive @skywind3000 is to something like that.
It only supports cmd.exe on windows.
But there is an alternative way:
:AsyncRun powershell /C "1 + 3"