Windows Terminal 安装与配置

1 安装

安装能够从应用商店安装(直接搜索便可)或者Github安装(能够戳这里):git

在这里插入图片描述

下载msixbundle格式的文件便可直接打开安装。github

2 配置前准备

2.1 下载字体

推荐使用FiraCode,下载连接戳这里json

解压后选择其中一个ttf安装便可:bash

在这里插入图片描述

2.2 安装PowerShell Core

这里的PowerShell Core与自带的PowerShell不是同一个东西,前者是能跨平台的,下载连接戳这里svg

Windows下能够直接选择msi格式下载:字体

在这里插入图片描述

安装好后能够对比一下新的PowerShell Core默认是黑底的,并且标题也不同:ui

在这里插入图片描述

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

安装过程当中可能会卡住,稍等便可。3d

另外有可能会提示不信任的仓库,选择y便可:code

在这里插入图片描述

3.2 修改PWSH为默认终端

打开Window Terminal的配置文件,查看list中有无PowerShell Core,若是没有,请手动添加到list中:blog

{
    "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修改主题颜色。

相关文章
相关标签/搜索