-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
fix: use specified shell on windows #182
Conversation
Use specified shell to determine command_sep, comment_sep, newline_chr
This seems to have broken one of the tests for toggling the terminal. Can you have a look? tests are run using plenary |
OK. I will check it later. |
I checked it, but it seems the test is already broken. |
Thanks @rikuma-t tested this out (on Mac) and nothing exploded, so LGTM, let's hope no other Windows users complain |
@rikuma-t this commit breaks my setup. I use |
end | ||
|
||
local function get_command_sep() | ||
return is_windows and is_cmd() and "&" or ";" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on my machine, on windows separator should always be &
.
I am sorry. My check was insufficient. In my environment, the -NoExit parameter was included, so it was working. |
@rikuma-t it's okay. I submitted a fix for it in #191. Could you check it? |
& does not seem to work when the built-in shell is powershell. Since command_sep,comment_sep is used to spawn a shell for toggleterm, it appears that vim.o.shell is the correct way to determine this. Looks like I should have fixed only newline_chr. I reverted command_sep,comment_sep to be determined by vim.o.shell and tested it and it works in both cmd and powershell. |
Are you using powershell or pwsh (a.k.a powershell core)? |
I checked with both to be sure, but neither worked as expected. I checked with the following toggleterm shell : powershell -NoProfile / pwsh -NoProfile let &shell = 'poweshell " or pwsh
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned - Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
set shellquote= shellxquote= |
@rikuma-t strange with exactly your configuration I have the following: powershell:
pwsh:
|
Toggleterm settings:
|
@Shatur Thanks for testing.
|
@Shatur I have tested with the following minimum configurations without success...
let &shell = has('win32') ? 'powershell' : 'pwsh'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command [Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
set shellquote= shellxquote=
lua <<EOF
require('toggleterm').setup({
open_mapping = '<F4>',
shade_terminals = false,
})
EOF
(branch is Shatur:pwsh-separator) |
Tried the same commands on my machine, I have the same output.
Hm... Can confirm, my branch it doesn't work with your configuration. Okay, I will close the PR until we find a better solution. Could you try the same setup, but with the following require('toggleterm').setup({
shell = 'pwsh',
open_mapping = '<F4>',
shade_terminals = false,
}) Run with |
Yes! |
Thank you so much! |
Thank you too! |
Fix newline_chr,command_sep,comment_sep to be set correctly even if vim.o.shell and the specified shell are different on windows.