How to set shell to powershell?
Closed this issue · 5 comments
VimWei commented
看到您将shell设置为powershell,我也试着设置如下,vim-terminal-help可以使用,但是会导致:PlugUpdate无法使用,AsyncRun也会有很多问题,还请教大神是如何设置shell的?
if has('win32') || has ('win64')
set shell=powershell.exe
set shellcmdflag=-NoProfile\ -NoLogo\ -NonInteractive\ -Command
set shellpipe=|
set shellredir=>
endif
leoatchina commented
`let g:terminal_shell = 'powershell'`
我这里运行很正常
VimWei commented
`let g:terminal_shell = 'powershell'`
我这里运行很正常
Great! Thanks!
VimWei commented
let g:terminal_shell = 'powershell'
调用的是Windows powershell 5.1 (Win 10环境)。
如何设置才能使用 PowerShell 6.2.3 ,而非Windows powershell 5.1?
skywind3000 commented
找到新powershell的完整路径并设置完整路径到该变量即可
VimWei commented
嗯,我设置了 let g:terminal_shell='pwsh'
或 let g:terminal_shell='C:\\Program Files\\PowerShell\\6\\pwsh.exe'
,确实可以调用PowerShell 6.2.3,但出现了一堆错误提示,看来还是得用Windows powershell:
PowerShell 6.2.3
Copyright (c) Microsoft Corporation. All rights reserved.
https://aka.ms/pscore6-docs
Type 'help' to get help.
FailFast:
The type initializer for 'Microsoft.PowerShell.ApplicationInsightsTelemetry' threw an exception.
at System.Environment.FailFast(System.String, System.Exception)
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String, System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
Exception details:
System.TypeInitializationException: The type initializer for 'Microsoft.PowerShell.ApplicationInsightsTelemetry' threw an exception. ---> System.ArgumentException: Item has already been added.
Key in dictionary: 'VIM_SERVERNAME' Key being added: 'VIM_SERVERNAME'
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Environment.ToHashtable(IEnumerable`1 pairs)
at System.Environment.GetEnvironmentVariables()
at Microsoft.ApplicationInsights.Extensibility.Implementation.Platform.PlatformImplementation..ctor()
at Microsoft.ApplicationInsights.Extensibility.Implementation.Platform.PlatformSingleton.get_Current()
at Microsoft.ApplicationInsights.Extensibility.Implementation.TelemetryConfigurationFactory.Initialize(TelemetryConfiguration configuration, TelemetryModules modules)
at Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.get_Active()
at Microsoft.PowerShell.ApplicationInsightsTelemetry..cctor()
--- End of inner exception stack trace ---
at Microsoft.PowerShell.ApplicationInsightsTelemetry.SendPSCoreStartupTelemetry()
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, String[] args)
at Microsoft.PowerShell.ConsoleShell.Start(String bannerText, String helpText, String[] args)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String consoleFilePath, String[] args, Int32 argc)