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

相关推荐
DONSEE广东东信智能读卡器8 天前
用PowerShell实现Windows 本地 WSS/HTTPS 自签名证书配置方法
windows·网络协议·https·powershell·身份证阅读器
DogDaoDao9 天前
Windows 下 Git 报错:`touch` 无法识别 —— 原因分析与 7 种解决方案(从入门到精通)
windows·git·程序员·npm·powershell·cmd·touch
console.log('npc')11 天前
Windows 11 安装 WSL2 + Ubuntu + Docker + Codex + Sub2API 教学
windows·docker·powershell·ubantu·codex
CV工程师(Ctrl)12 天前
Codex 在 Windows 中文路径执行bash命令编码问题复盘
powershell·codex
vortex514 天前
PowerShell 的命令补全方案: PSReadLine + PSCompletions + argc + Carapace
windows·powershell
tiandyoin14 天前
IPCONFIG重置网络
网络·ip·dfs·dns·vpn·cmd
tzy23323 天前
梳理一下前端模块化规范:CommonJS ESM AMD CMD UMD
前端·webpack·cmd·commonjs·amd·esm·umd
深念Y25 天前
踩坑实录:把 Windows 默认 PowerShell 换成 7.x 到底有多坑?一条龙解决指南
windows·乱码·bug·控制台·powershell·管道·流式
liulilittle1 个月前
OpenCode AI 代理配置(基本2)
cmd
今夕资源网1 个月前
Windows Terminal更舒适的命令行环境 仅11MB 支持并行运行WSLLinux子系统 github开源项目
windows·github·命令行·cmd·terminal