Windows Terminal 的美化使用

安装 Scoop

scoop 官网:https://scoop.sh/

使用管理员打开 powershell,写入以下命令进行安装

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

# 直接安装
irm get.scoop.sh | iex

# 指定安装位置安装
irm get.scoop.sh -outfile 'install.ps1'
.\install.ps1 -ScoopDir 'D:\Program Files\Scoop' -ScoopGlobalDir 'D:\Program Files\ScoopGlobalApps'

修改 scoop 安装软件的安装位置:

  1. 配置 当前用户 安装根目录
    scoop config root_path "D:\Program Files\Scoop"

  2. 配置全局安装目录(对所有用户都生效)
    scoop config global_path "D:\Program Files\ScoopGlobalApps"



安装 Windows Terminal (安装过了请跳过这步)

scoop bucket add extras
scoop install extras/windows-terminal


安装 Oh-My-Posh

oh-my-posh 官网:https://ohmyposh.dev/docs/

1. 开始安装

scoop install oh-my-posh

2. 查看安装情况

获取安装路径(然后添加到安全软件白名单):
(Get-Command oh-my-posh).Source

查看主题存放目录
echo $env:POSH_THEMES_PATH

主题存放地址:%USERPROFILE%\AppData\Local\Programs\oh-my-posh\themes
image

3. 查看主题

Get-PoshThemes

也可以去官网查看:https://ohmyposh.dev/docs/themes
image

4. 设置主题

使用此命令将主题写入配置,之后启用终端都会生效:

'oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\jandedobbeleer.omp.json" | Invoke-Expression' > $PROFILE
image

5. 修改主题

想改主题也很简单,主题文件名jandedobbeleer.omp.json 改 'jandedobbeleer' 为你想要的主题名字,比如 'aliens',最后重启终端 或 使用此命令 . $PROFILE 重新加载配置。

示例(修改主题为 aliens):
'oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\aliens.omp.json" | Invoke-Expression' > $PROFILE; . $PROFILE

6. 设置字体

如果出现乱码,则需要对终端设置 nerd-fonts 字体:
image

安装字体 oh-my-posh font install
image

对 windows terminal 设置字体,记得 Save:
image

posted @ 2023-10-08 17:20  灵火  阅读(158)  评论(0编辑  收藏  举报