Terminal & oh-my-posh3
Windows Terminal
从microStore上安装,或者winget安装winget install --id=Microsoft.WindowsTerminal -e
。安装完毕重启后,即添加到右键。
oh-myposh3
微软商店搜索下载(如果下载错误,打开用户账户控制设置,将“始终通知”栏拉到最高。这是微软的一个bug)。然后还必须下载相应的字体,字体官网;可以下载作者推荐的MesloLGM NF字体。下载完成后,解压,全选、点击安装。
- 然后打开Windows Termina,打开设置json文件,在profiles项下配置字体:
1 | "defaults": { |
命令行输入oh-my-posh init pwsh | Invoke-Expression
即可进行使用。
- 每次打开都需要输入以上命令行显然是很麻烦的,这时候需要配置poweshell执行脚本来使得每次打开powershell、程序会自动进入on-my-posh3。 如果新打开powershell窗口提示系统禁止运行脚本的话(计算机上启动 Windows PowerShell 时,执行策略很可能是 Restricted(默认设置)Restricted 执行策略不允许任何脚本运行),以管理员身份打开,命令行输入set-executionpolicy remotesigned即可。
1
2
3
4
5
6
7
8# 1. 启动编辑power shell配置文件的引擎
if (!(Test-Path -Path $PROFILE )) { New-Item -Type File -Path $PROFILE -Force }
# 2. 打开配置文件
notepad $profile
# 2. 写入配置脚本、保存。以后输入 notepad $profile 便可打开此文件进行脚本配置
oh-my-posh init pwsh | Invoke-Expression - 命令
Get-PoshThemes
可以安装主题,主题所在目录为C:\Users[user name]\AppData\Local\Programs\oh-my-posh\themes。配置主题的话,找到相应的主题名称,在配置脚本中这样写:1
oh-my-posh init pwsh --config C:\Users\[user name]\AppData\Local\Programs\oh-my-posh\themes\bubbles.omp.json | Invoke-Expression