oh-my-posh

1.PowerShell,让终端更好用

作为一名开发者,是不是经常羡慕MacOS和Linux上那些花里胡哨的终端?😍 Windows下的cmd.exe是不是看着很挫?但是你知道吗,Windows其实也自带了一个强大的Shell - PowerShell!🚀

PowerShell不仅命令行功能比cmd全面,还能直接调用.NET框架,脚本编写也很方便。可惜就是界面简陋了点,不够酷炫。🥺 但是别急,本文将手把手教你美化PowerShell,让它焕然一新!

2. 安装oh-my-posh

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

在PowerShell中运行以下命令安装Oh-my-posh:

scoop install oh-my-posh

我现在需要打开powershell 输入以下命令, 如果报错可能是计算机上没有创建好该文件,可以自行创建

notepad $PROFILE 

用记事本输入以下命令,themes是oh-my-post 存放主题的配置

  • D:/Scoop/apps/oh-my-posh/current/oh-my-posh.exe 安装的oh-my-posh位置
  • D:/Scoop/apps/oh-my-posh/current/themes/<font style="color:#DF2A3F;">M365Princess.omp.json</font> 主题名
# 导入oh-my-posh 并且应用agnosterplus主题
D:/Scoop/apps/oh-my-posh/current/oh-my-posh.exe init pwsh --config D:/Scoop/apps/oh-my-posh/current/themes/M365Princess.omp.json | Invoke-Expression

配置好重新打开powershell即可

3. 安装Nerd字体

image

你可能会看到主题里有一些方框,那是因为缺少支持Powerline的字体可以安装Nerd字体来解决。

scoop bucket add nerd-fonts


scoop install Hack-NF

重启终端,然后打开设置

image

选择其他设置里的外观

image

选择Hack Nerd Front 字体 保存,重启终端即可

image

posted @   ゐ叶う枫ゆ  阅读(96)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示