# TerminalX **Repository Path**: ricsy/TerminalX ## Basic Information - **Project Name**: TerminalX - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-21 - **Last Updated**: 2025-04-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: oh-my-posh ## README # 1. 📚 Terminal 终端配置 ## 1.1. Oh My Posh 官方地址: https://ohmyposh.dev/docs/installation/windows ### 1.1.1. 效果图 以 Windows Terminal CMD 为例 * 正常状态 ![正常](docs/images/img.png) * 异常状态 ![异常](docs/images/img_1.png) * Git 状态 ![Git](docs/images/img_2.png) ### 1.1.2. 安装 1. 安装 Oh My Posh 并将安装bin目录 `C:\Program Files (x86)\oh-my-posh\bin` 添加到 PATH 环境变量中 ```cmd choco install oh-my-posh ``` 2. 安装字体 命令安装时遇到无法下载,可以访问 [自选字体](https://www.nerdfonts.com) ```bash oh-my-posh font install RobotoMono ``` ### 1.1.3. 配置 #### 1.1.3.1. Power Shell 1. 配置 Power Shell 终端 ```powershell # 创建 PowerShell 配置文件 if (!(Test-Path -Path $PROFILE)) { New-Item -Type File -Path $PROFILE -Force } # 编辑配置文件 notepad $PROFILE ``` 文件内容如下(其中 cloud-native-azure.omp.json [自选主题](https://ohmyposh.dev/docs/themes) 替换): ``` # 第一种:默认路径 oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\cloud-native-azure.omp.json" | Invoke-Expression # 第二种:自定义路径 oh-my-posh init pwsh --config "c:\oh-my-posh.json" | Invoke-Expression ``` 2. 配置 Windows Terminal 终端(更换字体、去掉版本提示) ![更改字体](docs/images/img_3.png) ![去掉提示](docs/images/img_4.png) #### 1.1.3.2. CMD 1. 安装 click ``` scoop install clink ``` 2. 创建 Lua 脚本 `oh-my-posh.lua` ``` # 第一种方式:默认路径 load(io.popen('oh-my-posh init cmd --config "' .. os.getenv("POSH_THEMES_PATH") .. '\\cloud-native-azure.omp.json"'):read("*a"))() # 第二种方式:自定义路径 load(io.popen('oh-my-posh init cmd --config "C:\\oh-my-posh.json"'):read("*a"))() ``` 3. 将 Lua 脚本添加到 clink 中 ![放置脚本](docs/images/img_5.png) 4. 设置 clink 自动加载 Lua 脚本 ``` clink autorun install ``` 5. 配置 Windows Terminal 终端(更换字体) 6. 优化提示 ``` # 删除启动消息 clink set clink.logo none # 启动消息更短 clink set clink.logo short ``` 想要完全去掉包含 Windows自带的提示,`Win + R` 打开运行窗口,然后输入 `regedit` ,后续步骤参考下面: ``` @echo off & cls ``` ![去掉提示](docs/images/img_6.png)