使用Oh-My-Posh美化FluentTerminal

美化过程

  • STEP1:管理员权限powershell运行
    Set-ExecutionPolicy Bypass
    
  • STEP2:FluentTerminal运行
Install-Module DirColors -Scope CurrentUser
Install-Module posh-git -Scope CurrentUser
Install-Module oh-my-posh -Scope CurrentUser
  • STEP3:FluentTerminal下查看默认配置文件路径
$profile
  • STEP4:进入\WindowsPowerShell下编辑Microsoft.PowerShell_profile.ps1
  • STEP5:写入如下代码并保存:
Import-Module posh-git
Import-Module oh-my-posh
Import-Module DirColors
Set-Theme <主题名称> #终端下可Tab补全

例如博主的配置:

Import-Module posh-git
Import-Module oh-my-posh
Import-Module DirColors
Set-Theme tehrob

主题位于~\WindowsPowerShell\Modules\oh-my-posh\2.0.399\Themes,可以看到有13个主题!
在这里插入图片描述
单独在终端输入Set-Theme <主题名称>可临时预览!

在这里插入图片描述

添加鼠标右键菜单

新建文本,将以下脚本复制到文本中,另存为Install.bat,双击打开Install.bat即可

reg add "HKCU\Software\Classes\Directory\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%1\"" /f
reg add "HKCU\Software\Classes\Directory\Background\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%V\"" /f
reg add "HKCU\Software\Classes\LibraryFolder\Background\shell\Open Fluent Terminal here\command" /d "\"%LOCALAPPDATA%\Microsoft\WindowsApps\flute.exe\" new \"%%V\"" /f

删除鼠标右键菜单

操作同上,另存为Uninstall.bat,命令如下:

reg delete "HKCU\Software\Classes\Directory\shell\Open Fluent Terminal here" /f
reg delete "HKCU\Software\Classes\Directory\Background\shell\Open Fluent Terminal here" /f
reg delete "HKCU\Software\Classes\LibraryFolder\Background\shell\Open Fluent Terminal here" /f
发布了99 篇原创文章 · 获赞 83 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/weixin_43455581/article/details/105565970