本文介紹如何給Windows系統的終端進行打扮,最下面會有效果圖
一、安裝FluentTerminal
1、下載
前往GitHub找到下面的文件下載
2、安裝
下載後解壓,進入解壓後的目錄,找到Install.ps1
文件,右擊使用PowerShell
運行,彈出PowerShell
後,按照提示,就可以成功安裝了。
二、安裝oh my posh
1、設置可執行任意腳本
以管理員身份打開PowerShell執行以下命令,碰到詢問你是否幹嘛幹嘛的,直接輸入Y
確認
Set-ExecutionPolicy Bypass
2、安裝posh-git
Install-Module posh-git -Scope CurrentUser
3、安裝 oh my posh
碰到詢問你是否幹嘛幹嘛的,直接輸入Y
確認
Install-Module oh-my-posh -Scope CurrentUser
4、啓用
Import-Module oh-my-posh
三、美化
1、安裝Scoop
環境要求:
1、Windows 版本不低於 Windows 7
2、Windows 中的 PowerShell 版本不低於 PowerShell 3
3、你能 正常、快速 的訪問 GitHub 並下載上面的資源
4、你的 Windows 用戶名爲英文(Windows 用戶環境變量中路徑值不支持中文字符)
執行命令
#保證允許本地腳本的執行
set-executionpolicy remotesigned -scope currentuser
# 安裝
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
2、安裝字體
# 搜索 nerd fonts,這裏選擇是的FantasqueSansMono這個字體
scoop search FantasqueSansMono-NF
# 添加 nerd fonts 源
scoop bucket add 'nerd-fonts'
# 安裝 nerd fonts
scoop install FantasqueSansMono-NF
3、配置
以下是我舉例的配置,如果需要更換樣式,將Set-Theme
後面的配置改成自己想要的即可,在命令行通過輸入Set-Theme
以後空格以下然後按tab
鍵選擇你想要的,這都是oh-my-posh
自帶的,選擇好了之後將那個名字替換掉下面命令的即可
# 1、設置 Powershell 的 profile
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
# 2、打開該配置文件
notepad $PROFILE
# 3、複製以下內容到配置文件保存
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Agnoster
通過上面的操作後,關閉所有已經打開的命令行,重新啓動命令行,就可以看到效果啦,進入一個git項目,效果圖如下
文章到此結束啦,有啥疑問歡迎在評論區留言