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

相关推荐
fengyehongWorld2 天前
Powershell 自动安装Excel自定义标签页,开启宏
powershell
西西弗Sisyphus3 天前
PowerShell 配置为启动时自动激活 Conda 环境
conda·powershell
竹之却7 天前
如何使用 cmd 或 PowerShell 设置环境变量
环境变量·cmd·powshell
liulilittle18 天前
yt-dlp 实用命令速查手册(YouTube Downloader)
windows·shell·cmd
夫唯不争,故无尤也18 天前
curl与Invoke-RestMethod核心区别
后端·fastapi·powershell·curl
liulilittle18 天前
CMD命令行将 .lua 文件扩展名改为 .txt
windows·shell·cmd
bu_shuo20 天前
Windows电脑使用VSCode远程控制Windows主机方法记录
windows·vscode·ssh·powershell
Moshow郑锴1 个月前
WindowsRemoteAdmin(超级马里奥像素版)专为无远程登录桌面系统打造的便携式管理工具
java·powershell·远程控制·远程桌面·系统运维
超级大福宝2 个月前
PowerShell 实现类似 Bash 的补全行为
bash·powershell
小雪_Snow2 个月前
PowerShell 版本升级教程
powershell