安裝 Chocolatey,并使用 Chocolatey 安裝 ConEmu
官網(wǎng):https://chocolatey.org/
以管理員身份打開 powershell
愤估,運(yùn)行如下命令:
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'))
安裝完成后弓叛,關(guān)閉當(dāng)前的 powershell
窗口掂僵,重新以管理員身份打開一個(gè)新的 powershell
巾遭,使用以下命令安裝 ConEmu
:
choco install ConEmu
安裝 oh-my-posh
官網(wǎng):https://github.com/JanDeDobbeleer/oh-my-posh
posh-git
可以將 git
功能集成到 powershell
中,而 oh-my-posh
是用于 powershell
的主題引擎旷赖,類似于 OSX 和 Linux 系統(tǒng)中的 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
在打開的配置文件中輸入如下內(nèi)容:
# 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
的執(zhí)行策略辅髓,用來(lái)保證上面的配置能夠生效泣崩。
set-executionpolicy remotesigned
其中 Paradox
是要設(shè)置的主題名稱,可以使用的名稱及其對(duì)應(yīng)樣式如下:
-
Agnoster
-
Paradox
-
Sorin
-
Darkblood
-
Avit
-
Honukai
-
Fish
-
Robbyrussell
-
Pararussel
-
Material
-
Star
-
Zash
-
Lambda
-
Emodipt
-
Operator
安裝字體文件
打開下面的鏈接洛口,下載并安裝該字體文件矫付,用以支持 powershell
的 oh-my-posh
主題中的閃電(?)等特殊字符。
https://github.com/adam7/delugia-code/releases/download/v2102.03/Delugia.Nerd.Font.Complete.ttf
安裝 Windows Terminal
打開 Microsoft Store第焰,搜索 Windows Terminal 點(diǎn)擊“獲取”即可技即。
在 https://windowsterminalthemes.dev/ 中找到想要的主題,點(diǎn)擊 Get theme 復(fù)制主題配置文本樟遣。
設(shè)置 Windows Terminal而叼,ctrl+,
打開 settings.json
文件,找到一個(gè)名為 schemes
的數(shù)組豹悬,將剛剛復(fù)制的主題文本粘貼到該數(shù)組中葵陵,可以添加多個(gè)。
在 profiles
中找到 name
為 Windows PowerShell
的對(duì)象瞻佛,添加以下設(shè)置:
"colorScheme": "xxx", // 主題名稱
"useAcrylic": true, // 啟用毛玻璃效果
"closeOnExit": false,
"acrylicOpacity": 0.8, // 面板透明度
"fontFace": "Delugia Nerd Font",
"backgroundImage" : "D:\\Wallpaper\\xxx.png", // 背景圖片路徑
"backgroundImageAlignment" : "bottomRight", // 背景圖片對(duì)齊方式
"backgroundImageOpacity" : 0.3, // 背景圖片透明度
"backgroundImageStretchMode" : "fill", // 背景圖片填充方式
如果面板透明度設(shè)置無(wú)效脱篙,需要打開系統(tǒng)的透明效果。
設(shè)置-個(gè)性化-顏色-透明效果