Windows Terminal 基础设置及美化步骤

安装 Chocolatey,并使用 Chocolatey 安装 ConEmu

官网:https://chocolatey.org/

以管理员身份打开 powershell,运行如下命令:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

安装完成后,关闭当前的 powershell 窗口,重新以管理员身份打开一个新的 powershell,使用以下命令安装 ConEmu

choco install ConEmu

安装 oh-my-posh

官网:https://github.com/JanDeDobbeleer/oh-my-posh

posh-git 可以将 git 功能集成到 powershell 中,而 oh-my-posh 是用于 powershell 的主题引擎,类似于 OSX 和 Linux 系统中的 Oh-My-ZSH

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

编辑 powershell 的配置文件:

if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
notepad $PROFILE

在打开的配置文件中输入如下内容:

# Import Modules
Import-Module posh-git
Import-Module oh-my-posh

# Set Theme
Set-Theme Paradox

# Set MenuComplete
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

修改 powershell 的执行策略,用来保证上面的配置能够生效。

set-executionpolicy remotesigned

其中 Paradox 是要设置的主题名称,可以使用的名称及其对应样式如下:

  • Agnoster


  • Paradox


  • Sorin


  • Darkblood


  • Avit


  • Honukai


  • Fish


  • Robbyrussell


  • Pararussel


  • Material


  • Star


  • Zash


  • Lambda


  • Emodipt


  • Operator


安装字体文件

打开下面的链接,下载并安装该字体文件,用以支持 powershelloh-my-posh 主题中的闪电(⚡)等特殊字符。

https://github.com/adam7/delugia-code/releases/download/v2102.03/Delugia.Nerd.Font.Complete.ttf

安装 Windows Terminal

打开 Microsoft Store,搜索 Windows Terminal 点击“获取”即可。

在 https://windowsterminalthemes.dev/ 中找到想要的主题,点击 Get theme 复制主题配置文本。

设置 Windows Terminal,ctrl+, 打开 settings.json 文件,找到一个名为 schemes 的数组,将刚刚复制的主题文本粘贴到该数组中,可以添加多个。

profiles 中找到 nameWindows PowerShell 的对象,添加以下设置:

"colorScheme": "xxx", // 主题名称
"useAcrylic": true, // 启用毛玻璃效果
"closeOnExit": false,
"acrylicOpacity": 0.8, // 面板透明度
"fontFace": "Delugia Nerd Font",
"backgroundImage" : "D:\\Wallpaper\\xxx.png", // 背景图片路径
"backgroundImageAlignment" : "bottomRight", // 背景图片对齐方式
"backgroundImageOpacity" : 0.3, // 背景图片透明度
"backgroundImageStretchMode" : "fill", // 背景图片填充方式

如果面板透明度设置无效,需要打开系统的透明效果。
设置-个性化-颜色-透明效果

你可能感兴趣的:(Windows Terminal 基础设置及美化步骤)