WindowsCMD窗口配置OhMyPosh

WindowsCMD窗口配置OhMyPosh

文章目录

  • WindowsCMD窗口配置OhMyPosh
  • [1. 按装Clink](#1. 按装Clink)
    • [1. 安装Oh-My-Posh](#1. 安装Oh-My-Posh)
    • [2. 安装Clink](#2. 安装Clink)
    • [2. 安装后的位置](#2. 安装后的位置)
  • [2. 编写Lua脚本](#2. 编写Lua脚本)
    • [1. oh-my-posh Lua脚本](#1. oh-my-posh Lua脚本)
    • [2. 重启cmd窗口看效果](#2. 重启cmd窗口看效果)

OhMyPosh对Windows CMD 没有现成的支持。 然而可以使用Clink来做到这一点,它同时会增加CMD 体验。按照安装说明进行操作,并确保选择自动启动。

将 Oh My Posh 与 Clink 集成很简单:在 Clink 中创建一个名为 oh-my-posh.lua 的Lua脚本,然后在 cmd 中运行以查找该文件的位置来实现OhMyPosh对Widnows CMD命令窗口的支持

1. 安装Oh-My-Posh

详见:

官网地址:https://chrisant996.github.io/clink

这使用winget命令进行安装,安装后直接重启CMD窗口即可,无需额外的配置

shell 复制代码
# 安装 clink
winget install clink

2. 安装后的位置

安装后位置在 C:\用户\用户名\AppData\Local\clink目录下,如: C:\Users\23013\AppData\Local\clink

2. 编写Lua脚本

1. oh-my-posh Lua脚本

在Clink的安装目录下新建Lua脚本,如在C:\Users\23013\AppData\Local\clink目录下新建名称为oh-my-posh.lua的脚本文件,内容如下

shell 复制代码
load(io.popen('oh-my-posh init cmd'):read("*a"))()

2. 重启cmd窗口看效果

添加后,重新启动 cmd 以使更改生效。

相关推荐
JUNIOR_MU1 天前
【VMware VCF】使用 PowerVCF 连接和管理 VMware Cloud Foundation 环境。
powershell·vcf·vmware cloud foundation·powercli·powervcf·power validated solutions·request-vcftoken
豆小匠Coding4 天前
Windows安装Vim,并在PowerShell中直接使用vim
linux·编辑器·vim·powershell
前行中的小猪18 天前
如何让Windows控制台窗口不接受鼠标点击(禁用鼠标输入)
windows·控制台·cmd·禁止鼠标输入
△曉風殘月〆20 天前
C#命令行参数解析库System.CommandLine介绍
c#·命令行·cmd·命令行解析
sanzk22 天前
cmd命令
cmd
小Tomkk25 天前
PowerShell 脚本编写 :自动化Windows 开发工作流程
数据库·windows·powershell
svygh1231 个月前
powershell自动提交git脚本
git·自动化·办公自动化·powershell·自动化脚本
x-cmd1 个月前
x-cmd mod | x scoop - Windows 开源包管理工具
windows·开源·软件安装·命令行·powershell·包管理·winget
Ustinian_3101 个月前
【PowerShell】巧用 Windows PowerShell 实现自动化
运维·windows·自动化·powershell
HaiJaine2 个月前
告别痕迹:远程桌面连接历史和凭据的清零指南
powershell·rdp·安全隐私保护·技术教程·windows远程桌面·记录与凭据删除