关于windows:Windows-Terminal-安装与配置

2次阅读

共计 1162 个字符,预计需要花费 3 分钟才能阅读完成。

1 装置

装置能够从利用商店装置(间接搜寻即可)或者 Github 装置(能够戳这里):

下载 msixbundle 格局的文件即可间接关上装置。

2 配置前筹备

2.1 下载字体

举荐应用FiraCode,下载链接戳这里。

解压后抉择其中一个 ttf 装置即可:

2.2 装置PowerShell Core

这里的 PowerShell Core 与自带的 PowerShell 不是同一个货色,前者是能跨平台的,下载链接戳这里。

Windows下能够间接抉择 msi 格局下载:

装置好后能够比照一下新的 PowerShell Core 默认是黑底的,而且题目也不一样:

3 配置

3.1 模块

# PSReadline
Install-Module -Name PSReadLine -AllowPrerelease -Force

# posh-git
Install-Module posh-git -Scope CurrentUser

# oh-my-posh
Install-Module oh-my-posh -Scope CurrentUser

装置过程中可能会卡住,稍等即可。

另外有可能会提醒不信赖的仓库,抉择 y 即可:

3.2 批改 PWSH 为默认终端

关上 Window Terminal 的配置文件,查看 list 中有无 PowerShell Core,如果没有,请手动增加到list 中:

{"guid": "{60c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    "name": "PowerShell Core",
    //"icon":"C:\\My\\PowerShell\\7\\ps_black_64-svg.ico",
    "commandline": "pwsh.exe --nologo",
    "hidden": false
},

其中 guid 能够从 cmd 复制过去并批改其中一个字符即可,commandLine间接填 pwsh.exe,前面的--nologo 参数能够去掉烦人的提醒。至于图标,默认是没有图标的,须要手动增加,能够从 PowerShellGithub下载,并转换为 ico 格局,最初填上门路就能够失常显示了:

3.3 丑化

因为装置了 oh-my-posh,能够应用Set-Theme 切换主题,比方:

Set-Theme Agnoster

输出 Set-Theme 即可按 Tab 补全主题。

另外这样批改的主题只是长期失效,想要永恒失效须要写入配置文件中,输出:

$profile

会显示配置文件的地位,每个人不一样,没有的话就新建,在其中输出:

Import-Module posh-git
Import-Module oh-my-posh
Import-Module PSReadLine
Set-Theme Agnoster

即可使主题永恒失效。

另外,如果主题的色彩不称心,能够配合 Show-ColorsShow-ThemeColors批改主题色彩。

正文完
 0