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 以使更改生效。

相关推荐
龙泉寺天下行走1 天前
[powershell 入门]第9天:PowerShell 安全、代码签名与企业部署 作业及深度解析
安全·powershell
課代表2 天前
bat 批处理文件中 PowerShell 命令换行问题
符号·参数·powershell·批处理·换行·续行符·管道符
龙泉寺天下行走3 天前
[Powershell 入门教程]第10天:综合项目实战与进阶
powershell
龙泉寺天下行走8 天前
[powershell 入门教程]第9天:PowerShell 安全、代码签名与企业部署
安全·powershell
課代表9 天前
PowerShell 字符转 UniCode 编码
字符编码·类型转换·unicode·powershell·批处理·转义·[char]
fengyehongWorld11 天前
Powershell 实现系统静音
powershell
艾莉丝努力练剑12 天前
【Git:企业级开发模型】Git企业级Git工作流实战:基于Git Flow的分支模型与开发流程
服务器·git·ubuntu·gitee·centos·powershell·企业级开发模型
八月ouc14 天前
解密JavaScript模块化演进:从IIFE到ES Module,深入理解现代前端工程化基石
javascript·es6·模块化·cmd·commonjs·amd·iife
charlee4420 天前
Git使用经验总结8-Git仓库历史记录清除
git·powershell·敏感信息·仓库重置·历史重写
tq10861 个月前
一个简单的 PowerShell REPL 脚本
powershell