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

This commit is contained in:
2022-06-14 22:38:21 +08:00
parent 36397ff348
commit 2753c60fca
4 changed files with 40 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -0,0 +1,40 @@
---
slug: 用 oh-my-posh 美化 Git bash
title: 用 oh-my-posh 美化 Git bash
description:
toc: true
authors:
- awin
tags:
- terminal
categories:
- Tool setup
series:
- Windows
date: 2022-06-14T00:00:00
lastmod: 2022-06-14T00:00:00
featuredVideo:
featuredImage:
draft: false
enableComment: true
---
讓 [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701) 中的 Git bash 也可以美美的。
<!--more-->
## 步驟
以下步驟都是在 [Windows Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701) 中的 Git bash[^1] 執行。
1. 先下載一個你喜歡的theme: [https://ohmyposh.dev/docs/themes](https://ohmyposh.dev/docs/themes)
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)"`
注意最後的 `montys.omp.json` 就是第一步下載的theme這邊要改成你自己的路徑。
5. 修改 Windows Terminal 的 `setting.json`,將字型改為 `CaskaydiaCove NF`
![](images/20220614221618_oh-my-posh_setting.png)
[^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)