CMD美化及功能增强: Clink + Oh My Posh + Fastfetch + msys2

CMD美化及功能增强: Clink + Oh My Posh + Fastfetch + msys2
lololoweLinux终端美化:https://blog.lololowe.com/posts/dd02/
Windows Terminal
发行版地址:https://github.com/microsoft/terminal/releases/latest
下载msixbundle安装包,然后双击安装即可升级到最新版。
主题:Oh My Posh
官网:https://ohmyposh.dev/docs/installation/windows
CRXsoso: https://www.crxsoso.com/store/detail/xp8k0hkjfrxgck
在线预览所有主题: https://ohmyposh.dev/docs/themes
Nerd字体
官网:https://www.nerdfonts.com/font-downloads
CMD增强:Clink
官网:https://chrisant996.github.io/clink/
安装完成后重启Windows Terminal中的CMD,然后输入clink info
命令获取插件目录:
打开插件目录,创建oh-my-posh.lua
脚本,内容如下:
1 | load(io.popen('oh-my-posh init cmd --config C:\\Users\\%username%\\AppData\\Local\\Programs\\oh-my-posh\\themes\\hunk.omp.json'):read("*a"))() |
替换主题只需修改hunk
为其他主题名称即可。
开启“瞬态提示符”(transient prompt): clink set prompt.transient same_dir
去掉启动banner:clink autorun install -- --quiet
详细教程:https://halc.top/p/82bd449c
下一代ls命令: lsd
项目地址:https://github.com/lsd-rs/lsd
安装: winget install --id lsd-rs.lsd
系统配置显示:Fastfetch
项目地址:https://github.com/fastfetch-cli/fastfetch#windows
使用winget安装会自动配置环境变量: sudo winget install fastfetch
为了让cmd启动时自动运行fastfetch,再次打开clink插件目录,创建clink_startup.lua
脚本,内容如下:
1 | -- 切换到指定目录 |
fastfetch配置文件(%userprofile%\.config\fastfetch\config.jsonc
)如下:
1 | { |
效果如下:
更多好看的配置:https://github.com/sqlsec/fastfetch
类unix操作环境:msys2
这里下载msys2主要是为了使用里面的unix工具,比如git,vim,wget等,以及一些编译工具,比如gcc,gdb等。
安装完成后将msys2安装目录下的`usr/bin/目录添加到环境变量中,就可以在cmd中调用msys2的工具了。
msys2换源:
1. 中科大源: https://mirrors.ustc.edu.cn/help/msys2.html
2. 清华源: https://mirrors.tuna.tsinghua.edu.cn/help/msys2/
安装常用工具:
1 | pacman -Sy # 更新软件包数据库 |
msys2添加到Windows Terminal中的配置:
1 | { |
msys2的美化教程(ZSH+Oh My Posh): https://github.com/wszqkzqk/wszqkzqk.github.io/blob/master/_posts/2022-06-24-%E5%9C%A8%E4%B8%8D%E5%80%9F%E5%8A%A9oh-my-zsh%E7%9A%84%E5%89%8D%E6%8F%90%E4%B8%8B%E8%BF%9B%E8%A1%8CZsh%E9%85%8D%E7%BD%AE.md