Win10 命令行美化筆記
對win10自帶的Power Shell進(jìn)行美化,目標(biāo):
- 不需要單獨(dú)啟動(
Fluent Terminal等),能與原生的Power Shell完美契合。 - 比較美觀,符合主流審美,高亮、提示功能友好。原生的
Power Shell在處理命令行的參數(shù)時字體顏色偏暗。
主要工具
-
Scoop:windows 系統(tǒng)中的包管理工具,可用于下載
ConEmu。 -
ConEmu:命令行客戶端,可設(shè)置為替代原生的
Power Shell,符合第一點(diǎn)目標(biāo)。 -
oh-my-posh:
ConEmu中Power Shell提示的主題功能。 - Power Line 字體:用于替換原生命令行的字體,并增加擴(kuò)充字體圖標(biāo)庫。
- Git:用于從碼云下載 Power Line 字體
具體操作
-
安裝 Scoop:
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') -
安裝 ConEmu:
scoop install ConEmu -
安裝以及調(diào)教 oh-my-push:
Install-Module posh-git -Scope CurrentUser Install-Module oh-my-posh -Scope CurrentUser中途會要求確認(rèn):
- 安裝導(dǎo)入
NuGet:y - 從
PSGallery安裝模塊:a
初始化以及配置:
# 默認(rèn)設(shè)置 Set-Prompt # 設(shè)置配色主題 Set-Theme Agnoster修改PowerShell的配置文件,讓每一次啟動時自動加載一些配置:
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force } notepad $PROFILE在打開的配置文件中添加:
Import-Module posh-git Import-Module oh-my-posh Set-Theme Agnoster(這里可以是任意配色主題)其他相關(guān)配置以及所有可用主題可參考 https://github.com/JanDeDobbeleer/oh-my-posh#configuration 。
- 安裝導(dǎo)入
-
安裝 Power Line 字體:
git clone https://github.com/powerline/fonts.git --depth=1 cd fonts ./install.ps1安裝完后,可以刪了這個文件夾。
-
調(diào)教 ConEmu:
打開 ConEmu,在
標(biāo)題欄-右鍵-settings進(jìn)入設(shè)置界面。- 修改語言:
通用-Interface language選擇zh: 簡體中文 - 修改字體:
通用-字體-控制臺主要字體選擇Meslo LG M Regular for Powerline Nerd Font - 修改字符集:
通用-字體-Unicode 范圍選擇Dashes and Borders: 2013-2015;2500-25C4; - 修改默認(rèn)shell:
啟動-任務(wù)-預(yù)定義的任務(wù)-{Shells::PowerShell(Admin)}右側(cè)勾選默認(rèn)shell - 替換默認(rèn) PowerShell :
集成-默認(rèn)終端右側(cè)勾選強(qiáng)制使用ConEmu作為控制臺的默認(rèn)終端、在系統(tǒng)啟動時注冊 - 修改主題配色:
通用-Choose color scheme選擇Babun - 設(shè)置多窗口運(yùn)行:
通用-外觀取消勾選單例模式, 標(biāo)題欄設(shè)置不隱藏,在通用-標(biāo)簽欄中設(shè)置不要顯示,在功能特性-狀態(tài)欄取消勾選顯示狀態(tài)欄
以上配置文件信息(保存在
xml文件中,可以直接導(dǎo)入):Github:ConEmu-settings - 修改語言: