是时候扔掉cmder, 换上Windows Terminal

作为一个Windows的长期用户,一直没有给款好用的终端,知道遇到了 cmder,它拯救一个习惯用Windows敲shell命令的人。

不用跟我安利macOS真香!公司上班一直用macOS,一方面确实更加习惯windows下面学习, 另一方面是上课需要Windows QQ共享桌面。

windows Terminal 1.0发布,那么是时候和 cmder 说再见了。

不过需要做一些配置和美化。

美化主题

  • 安装posh-git和oh-my-posh
复制代码
  1. > Install-Module posh-git -Scope CurrentUser

  2. > Install-Module oh-my-posh -Scope CurrentUser

  • 启用默认设置

    Set-Prompt

  • 设置主题:

    Set-Theme Sorin

oh-my-posh 支持十几种主题:

复制代码
> Set-Theme
 
位于命令管道位置 1 的 cmdlet Set-Theme
请为以下参数提供值:
name: ?
 
警告: Theme ? not found. Available themes are:
 
Name                  Type     Location
----                  ----     --------
Agnoster              Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Agnoster...
AgnosterPlus          Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Agnoster...
Avit                  Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Avit.psm1
Darkblood             Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Darkbloo...
Fish                  Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Fish.psm1
Honukai               Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Honukai....
Paradox               Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Paradox....
Powerlevel10k-Classic Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Powerlev...
Powerlevel10k-Lean    Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Powerlev...
PowerLine             Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\PowerLin...
pure                  Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\pure.psm1
robbyrussell          Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\robbyrus...
Sorin                 Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\Sorin.psm1
tehrob                Defaults C:\Users\fnngj\Documents\WindowsPowerShell\Modules\oh-my-posh\2.0.412\Themes\tehrob.psm1
  • 使用记事本打开PS配置文件(如无则创建该文件)

    if (!(Test-Path -Path PROFILE )) { New-Item -Type File -Path PROFILE -Force } notepad $PROFILE

随后,在打开的记事本窗口里,在文末加入下面内容,以让Powershell在启动之时应用主题,然后保存。(仅对当前用户生效)

复制代码
Import-Module posh-git
Import-Module oh-my-posh
Set-Theme Sorin

设置字体

如果你设置的主题出现乱码,可以安装SarasaGothic字体库。

复制代码
> scoop bucket add nerd-fonts
> scoop install SarasaGothic

或者直接到github下载:

Releases · be5invis/Sarasa-Gothic · GitHub

然后,将字体库解压 复制到 C:\Windows\Font\ 目录。

Windows Terminal 设置

点击 Windows Terminal 向下箭头,选择设置,将会找打开一个配置文件。

复制代码
// This file was initially generated by Windows Terminal 1.0.1401.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "defaultProfile": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
    // You can add more global application settings here.
    // To learn more about global settings, visit https://aka.ms/terminal-global-settings
    // If enabled, selections are automatically copied to your clipboard.
    "copyOnSelect": false,
    // If enabled, formatted data is also copied to your clipboard
    "copyFormatting": false,
    // A profile specifies a command to execute paired with information about how it should look and feel.
    // Each one of them will appear in the 'New Tab' dropdown,
    //   and can be invoked from the commandline with `wt.exe -p xxx`
    // To learn more about profiles, visit https://aka.ms/terminal-profile-settings
    "profiles": {
        "defaults": {
            // Put settings here that you want to apply to all profiles.
            "fontFace": "Sarasa Term Slab SC",  // 选择字体,前面安装的
            "backgroundImage" : "C:/Users/fnngj/Pictures/bg.jpg",  // 设置背景图片
            "backgroundImageOpacity" : 0.9, // 背景图片透明度
            "fontSize" : 16,  // 字体大小
            "foreground": "#76EE00"  //字体颜色
        },
       //...

当然,你也可以在继续安装vim 工具,来更加符合你的 shell习惯。

总结:

感谢每一个认真阅读我文章的人!!!

作为一位过来人也是希望大家少走一些弯路,如果你不想再体验一次学习时找不到资料,没人解答问题,坚持几天便放弃的感受的话,在这里我给大家分享一些自动化测试的学习资源,希望能给你前进的路上带来帮助

软件测试面试文档

我们学习必然是为了找到高薪的工作,下面这些面试题是来自阿里、腾讯、字节等一线互联网大厂最新的面试资料,并且有字节大佬给出了权威的解答,刷完这一套面试资料相信大家都能找到满意的工作。

相关推荐
触底反弹12 分钟前
拷个 .exe 到新电脑就跑不起来?你缺的不是文件,是对链接的理解
c++·windows·操作系统
W优化大师25 分钟前
Windows 更新待处理弹窗一直不消失怎么解决,C 盘空间和后台任务该如何排查
windows·系统优化·磁盘清理·windows11·c盘·系统更新
无风听海1 小时前
在 ASP.NET Core 开发环境中为自定义域名签发受信任的自签名证书—HSTS 启用后的完整实践
windows·后端·asp.net
Ztopcloud极拓云视角2 小时前
我用AI辅助做了一个多端工具:解决2026世界杯回放被剧透的问题
人工智能·windows·个人开发
love530love2 小时前
2026年终极防坑指南:基于 EPGF 架构彻底“本地化” UV 环境与工具
人工智能·windows·python·架构·devops·uv·epgf
虾壳云官方2 小时前
【本地 AI 自动化最新工具】 OpenClaw 2.7.9 Windows 完整部署教程(包含安装包)
人工智能·windows·openclaw·openclaw安装·openclaw一键部署
lzjava20242 小时前
Python的数据结构,推导式、迭代器和生成器
数据结构·windows·python
接着奏乐接着舞3 小时前
springboot mp mybatis plaus
windows·spring boot·mybatis
程序员佳佳3 小时前
四个月长期实测:自建 Milvus、FAISS、原生向量 API 和向量引擎中转方案,到底怎么选?
人工智能·windows·python·gpt·milvus·faiss
吠品3 小时前
.NET 8 单文件发布:把 exe 和一堆 dll 打进一个文件里
服务器·数据库·windows