oh-my-posh
一、来源
某天看到C哥的终端好漂亮,突然也想试一试,了解到oh-my-posh,确实漂亮。安装过程还蛮顺利的,文档已经很完善了。官网
二、安装
刚开始没注意,以为只能安装到powershell
,后面发现可以安装到windwos terminial
2.1 oh-my-posh的安装
微软商店安装即可成功
2.2 下载喜欢的字体
字体网站
2.3 初始化配置文件
New-Item -Path $PROFILE -Type File -Force
编辑配置文件
notepad $PROFILE
添加以下内容
oh-my-posh init pwsh | Invoke-Expression
2.4 自定义主题
官方主题页面
配置文件多一个参数即可
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH/jandedobbeleer.omp.json" | Invoke-Expression
也可以使用在线主题
oh-my-posh init pwsh --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json' | Invoke-Expression
2.5 上诉其实是在powershell的配置,下面介绍cmd的配置
需要借助clink来自动覆盖cmd
2.6 github release页面下载安装clink
2.7 查看clink环境变量
clink info
2.8 一个是以下路径
C:\Users\我的用户名\AppData\Local\clink
2.9 配置脚本oh-my-posh.lua
load(io.popen('oh-my-posh init cmd --config "C:/Users/我的用户名/AppData/Local/Programs/oh-my-posh/themes/easy-term.omp.json"'):read("*a"))()
3.0 顺带统一以下linux与windows的一些命令clink_inputrc.lua
-- Define aliases
os.setalias("ll", "dir")
os.setalias("ls", "dir")
os.setalias("gs", "git status")
os.setalias("ga", "git add .")
os.setalias("gc", "git commit -m")
os.setalias("gp", "git push")
os.setalias("ifconfig", "ipconfig")
os.setalias("pwd", "powershell -Command \"(Get-Location).Path\"")
linux 安装
1.脚本下载安装
curl -s https://ohmyposh.dev/install.sh | bash -s
2.安装字体
oh-my-posh font install
oh-my-posh font install meslo
3.添加到环境变量
cat >>~.bashrc
eval "$(oh-my-posh init bash)"
eval "$(oh-my-posh init bash --config 'https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/jandedobbeleer.omp.json')"
4.效果
Linux在xshell并不怎么好,放弃。只有cmd才由一样的效果。
版权声明:
作者:qiankong
链接:https://bravexist.cn/2024/06/oh-my-posh.html
文章版权归作者所有,未经允许请勿转载。
THE END