Windows Terminal 配置 PowerShell
-
Microsoft Store 下载安装 Windows Terminal
-
安装显示界面的字体:Fira Code,该字体支持 ligature 连字功能,而且是一款专门为代码显示准备的字体。
-
安装 Powershell Core(全部下一步即可,最好不要自定义安装), 颜值和功能都比原版PowerShell强:
-
安装PowerShell插件,打开刚装好的新版 powershell,逐行输入命令:
# 1. 安装 PSReadline 包,该插件可以让命令行很好用,类似 zsh
Install-Module -Name PSReadLine -AllowPrerelease -Force
# 2. 安装 posh-git 包,让你的 git 更好用
Install-Module posh-git -Scope CurrentUser
# 3. 安装 oh-my-posh 包,让你的命令行更酷炫、优雅
Install-Module oh-my-posh -Scope CurrentUser
# 后面两个包的来源可能不受系统信任,不用管它,如果让你选择是否信任,直接输入 Y 即可。
# 安装过程可能有点慢,好像卡住了一样,但是请耐心等待几分钟。另外,可能需要挂代理才能下载、安装。这几个包的都不大,所以如果迟迟装不上,就基本上是网络问题。
- 配置WindowsTerminal的命令行
{
"colorScheme": "Homebrew",
"commandline": "C:/Program Files/PowerShell/7/pwsh.exe -nologo",
"fontFace": "Fira Code",
"fontSize": 11,
"guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
"hidden": false,
"historySize": 9001,
"name": "PowerShell",
"padding": "5, 5, 20, 25",
"snapOnInput": true,
"source": "Windows.Terminal.PowershellCore",
"startingDirectory": ".",
"useAcrylic": false
}
- 配置终端显示的颜色
{
"name": "Homebrew",
"black": "#000000",
"red": "#FC5275",
"green": "#00a600",
"yellow": "#999900",
"blue": "#6666e9",
"purple": "#b200b2",
"cyan": "#00a6b2",
"white": "#bfbfbf",
"brightBlack": "#666666",
"brightRed": "#e50000",
"brightGreen": "#00d900",
"brightYellow": "#e5e500",
"brightBlue": "#0000ff",
"brightPurple": "#e500e5",
"brightCyan": "#00e5e5",
"brightWhite": "#e5e5e5",
"background": "#283033",
"foreground": "#00ff00"
}