-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support powershell with nvim #287
base: master
Are you sure you want to change the base?
Conversation
This is a regression, Have you ever considered why I am using args as a single string for nvim while using an array for vim? Why did I take nvim as a special case? You just convert the nvim code to the vim code and eliminate that special case. btw: when args is an array, no need to escape its items. |
@skywind3000 Thanks for your comments, I agree that the previous request was wrong I have changed the pull request. The bug that I have identified is powershell will not execute a command wrapped in quotes i.e., Bad Ok cmd will execute quoted commands So I have added an option to not quote the command, You could use a different approach instead of executing you could prepend with a cmd.exe command similar to what I was attempting in the first commit, but only when the user selects it |
Just reset the shell and then restore after the command. Then it will also work with program_msys. I have: fun! shells#shell_backup(...)
let l:curr = {}
if a:0 == 0
let l:curr['shell'] = &shell
let l:curr['shellcmdflag']= &shellcmdflag
let l:curr['shellpipe'] = &shellpipe
let l:curr['shellquote'] = &shellquote
let l:curr['shellredir'] = &shellredir
let l:curr['shellslash'] = &shellslash
let l:curr['shelltemp'] = &shelltemp
let l:curr['shellxescape']= &shellxescape
let l:curr['shellxquote'] = &shellxquote
return l:curr
elseif a:0 == 1
let l:curr = a:1
let &shell = l:curr['shell']
let &shellcmdflag = l:curr['shellcmdflag']
let &shellpipe = l:curr['shellpipe']
let &shellquote = l:curr['shellquote']
let &shellredir = l:curr['shellredir']
let &shellslash = l:curr['shellslash']
let &shelltemp = l:curr['shelltemp']
let &shellxescape = l:curr['shellxescape']
let &shellxquote = l:curr['shellxquote']
endif
endfun
fun! shells#shell_reset()
set shell&
set shellcmdflag&
set shellpipe&
set shellquote&
set shellredir&
set shellslash&
set shelltemp&
set shellxescape&
set shellxquote&
endfun diff --git a/plugin/asyncrun.vim b/plugin/asyncrun.vim
index 8e351c7..95912ab 100644
--- a/plugin/asyncrun.vim
+++ b/plugin/asyncrun.vim
@@ -263,7 +263,10 @@ function! s:shellescape(path)
if s:asyncrun_windows == 0
return shellescape(a:path)
endif
+ let s:user_shell = shells#shell_backup()
+ call shells#shell_reset()
let hr = shellescape(a:path)
+ call shells#shell_backup(s:user_shell)
if &ssl != 0
let hr = s:StringReplace(hr, "'", '"')
endif
|
Thanks for your patch, I've been thinking about this issue in the past couple of days. Since the command is written to So I made a new release, which force to use "cmd.exe" as "g:asyncrun_shell" on Windows. https://github.com/skywind3000/asyncrun.vim/releases/tag/2.12.8 |
Just tested 2.12.8 and received the following error on Windows using nvim. The same
I reverted the changes in 2.12.8 and tested the solution suggested by @pedrohgmacedo. This change did not work for me. However, the following solution inspired by @Mitch6886 does work:
In addition, with these changes I am able to asynchronously run commands in PowerShell by setting
|
I haven't tested on neovim tbh. But the latest version is still working in my config though. |
@bjjblackbelt , what is your current setting of |
jobstart is neovim only. job_start is vim only. |
|
I tested without my config files and just loading the asyncrun plugin. All appears to be working well with
It appears the issue is on my end, though do not know what it could be. The 'fix' I posted earlier still works with my configs and plugins. Will keep exploring. Thank you for the quick response. |
still can't reproduce it, are you sure you were using 2.12.8 (and have your nvim restarted after updating) ? |
sorry, |
I tracked down my problem to having the |
Version 2.12.9 works on my system with |
The purpose of this pull request is to allow changing the shell on windows with nvim.
I am using nvim with windows and my nvim shell is powershell,
I have not to integrated this pluggin with powershell,
However, I could integrate this with cmd by setting
And perfoming this code change
shellescape is overwriting s:args meaning the custom shell and flags (e.g. ["cmd.exe", "/C"]) are discarded
Edit
Pull request is now to support powershell as the default shell