以下命令均在自己安装的powershell中执行
一. 基本字体支持
由于部分主题使用到了使用了一些非 Powerline
字体不支持的字符,所以我们需要先安装字体,默认安装了 git
将字体 clone
下来 :
git clone https://github.com/powerline/fonts.git
安装
cd fonts
./install.ps1
删除
cd ..
rm fonts
powershell
更新时字体设置
(1) powershell
端
打开 属性
->字体
进行字体设置,选择 DejaVu Sans Mono for Powerline
(2)vscode
terminal
端
在配置文件中查找 terminal font
,配置你想要的字体
二.下载安装主题模块
安装 posh-git
和 oh-my-posh
这两个模块,powershell
中运行以下命令
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
添加如下内容,Set-PoshPrompt <主题名>
,配置中想知道主题名可以使用 Get-PoshThemes
查看支持主题
Import-Module posh-git
Import-Module oh-my-posh
Set-PoshPrompt paradox