简介
- github: https://github.com/JanDeDobbeleer/oh-my-posh
- docs: https://ohmyposh.dev/
docs中有详细的安装和使用说明,下文中有不明白的可以移步官方文档自行学习使用~
安装
下面以新安装的x86_64的debian环境进行举例
Linux debian 5.10.0-19-amd64 #1 SMP Debian 5.10.149-2 (2022-10-21) x86_64 GNU/Linux
针对内网和非root用户进行安装,避免污染其他用户的使用环境
#!/bin/bash
mkdir -p ~/oh-my-posh
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/posh-linux-amd64 -O ~/oh-my-posh/posh;
chmod +x ~/oh-my-posh/posh;
mkdir -p ~/oh-my-posh/.poshthemes;
wget https://github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/themes.zip -O ~/oh-my-posh/.poshthemes/themes.zip;
unzip -q ~/oh-my-posh/.poshthemes/themes.zip -d ~/oh-my-posh/.poshthemes;
rm ~/oh-my-posh/.poshthemes/themes.zip -vf;
chmod u+rw ~/oh-my-posh/.poshthemes/*.omp.*;
sed -i '$a eval "$(~/oh-my-posh/posh init bash --config ~/oh-my-posh/.poshthemes/montys.omp.json)"' ~/.profile;
source ~/.profile;
示例动画
montys.omp.json主题微调
由于montys主题默认会在powerline中输出完整的路径,当路径层级较深时,powerline显示就太长了,因此参考文档进行了微调。
diff --git a/themes/montys.omp.json b/themes/montys.omp.json
index c7797e88..c8eeb6c4 100644
--- a/themes/montys.omp.json
+++ b/themes/montys.omp.json
@@ -17,10 +17,11 @@
"foreground": "#ffffff",
"powerline_symbol": "\ue0b0",
"properties": {
- "folder_icon": "\uf115",
+ "folder_icon": "\uf07c",
"folder_separator_icon": "\\",
"home_icon": "\uf7db",
- "style": "full"
+ "style": "agnoster_short",
+ "max_depth": 3
},
"style": "powerline",
"template": " <#000>\uf07b \uf553</> {{ .Path }} ",
效果对比:
before:
after:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)