Add: 用 oh-my-posh 美化 Git bash

This commit is contained in:
2022-07-26 14:41:30 +08:00
parent 2753c60fca
commit dd474b5177

View File

@@ -29,12 +29,19 @@ enableComment: true
2. 下載並安裝字型:[Caskaydia Cove Nerd Font](https://github.com/ryanoasis/nerd-fonts/releases/download/v2.1.0/CascadiaCode.zip?WT.mc_id=-blog-scottha)
3. Install OhMyPosh: `winget install JanDeDobbeleer.OhMyPosh`
4. 建立並修改 `~/.profile`,然後加入
`eval "$(oh-my-posh --init --shell bash --config ~/OneDrive/appConfigs/ohmyposh/themes/montys.omp.json)"`
`eval "$(oh-my-posh --init --shell bash --config ~/montys.omp.json)"`
注意最後的 `montys.omp.json` 就是第一步下載的theme這邊要改成你自己的路徑。
5. 修改 Windows Terminal 的 `setting.json`,將字型改為 `CaskaydiaCove NF`
![](images/20220614221618_oh-my-posh_setting.png)
6. 重開 Windows Terminal
[^1]: 在 [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701) 中設定 Git bash 可以參考:[Windows Terminal's 設定 Git Bash 和 SSH @ 傑克! 真是太神奇了! :: 痞客邦 ::](https://magicjackting.pixnet.net/blog/post/225162505-windows-terminal's-%E8%A8%AD%E5%AE%9A-git-bash-%E5%92%8C-ssh)
## 成果
![20220614_221915_WindowsTerminal_1244x262.png](images/20220614_221915_WindowsTerminal_1244x262.png)
## 參考
- [Oh My Posh](https://ohmyposh.dev/)
- [How to make the ultimate Terminal Prompt on Windows 11 - This video is LONG and WORDY and DETAILED - YouTube](https://www.youtube.com/watch?v=VT2L1SXFq9U)
- [My Ultimate PowerShell prompt with Oh My Posh and the Windows Terminal - Scott Hanselman's Blog](https://www.hanselman.com/blog/my-ultimate-powershell-prompt-with-oh-my-posh-and-the-windows-terminal)
- [Windows-Terminal配置OhMyPosh来美化GitBash_偕臧x的博客-CSDN博客](https://blog.csdn.net/qq_33154343/article/details/120661945)