windows美化终端

mac osoh-my-zsh + itrem2,做终端美化;windows 也有对应的解决方案,即 oh-my-posh + Conemu

1. 安装Oh My Posh

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

1. winget 切换国内源
# 删除由 Microsoft 维护的官方源
winget source remove winget

# 添加中科大开源软件镜像源
winget source add winget https://mirrors.ustc.edu.cn/winget-source

# 换源完成后,可以通过以下命令进行验证和查看
winget source list

# 如果要恢复使用 Microsoft 官方源,可以使用以下命令进行重置
winget source reset winget
2. 安装 Oh My Posh
winget install JanDeDobbeleer.OhMyPosh -s winget
3. 安装Nerd Fonts字体

Nerd Fooonts 字体官网:https://www.nerdfonts.com/font-downloads

注:Oh My Posh使用的主题存在一些特殊字体,所以需要专门下载字体支持显示,否则会出现乱码

4. 安装 Oh My Posh 插件
# 给目录加颜色
Install-Module DirColors
# Git插件
Install-Module posh-git -Scope CurrentUser
# 给目录加图标
Install-Module -Name Terminal-Icons -Repository PSGallery

# 自动补全, 不建议安装,没有必要
Install-Module -Name PSReadLine -Scope CurrentUser -Force
5. 配置配置文件

使用命令打开配置文件:

notepad $Profile

oh-my-posh 主题存储在 C:\Users\用户名\AppData\Local\Programs\oh-my-posh\themes\ ,里面的 json 文件即为主题文件,自己选择一个即可,主题浏览页面如下:https://ohmyposh.dev/docs/themes

编辑文件内容,并保存:

oh-my-posh init pwsh --config "C:\Users\wanghoukun\AppData\Local\Programs\oh-my-posh\themes\gruvbox.omp.json"  |  Invoke-Expression

Import-Module posh-git
Import-Module DirColors
Import-Module -Name Terminal-Icons
# Import-Module PSReadLine
6. 安装 Conemu
  1. 配置 启动任务Shell::powerShell
  2. 配置字体为 Nerd Fonts 字体

参考:https://blog.csdn.net/qq_44625774/article/details/140237194
https://post.smzdm.com/p/a5k6e033/
https://dev.net.cn/276.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值