https://ddochea.tistory.com/190
밋밋하기만 한 파워셸을 한층 예쁘게 꾸며주는 Oh My Posh 를 설치해보았다. 설치방법은 공식 사이트에 설명되어있으나 그대로 수행하면 VSCode에선 오류가 나는등의 이슈가 있어 간략하게 재 정리하였다.
정리한 내용은 Windows 11 Host 환경(WSL 아님)을 기준으로 작성했다.
winget install JanDeDobbeleer.OhMyPosh
아래 파일은 Oh My Posh 테마 중 1개인 M365Princess 테마이다.
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": true,
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
{
"type": "session",
"style": "diamond",
"foreground": "#ffffff",
"background": "#9A348E",
"leading_diamond": "\uE0B6",
"trailing_diamond": "",
"properties": {
"prefix": "",
"template": "{{ .UserName }}"
}
},
{
"type": "path",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#DA627D",
"properties": {
"style": "folder"
}
},
{
"type": "git",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#FCA17D",
"properties": {
"fetch_stash_count": true,
"fetch_upstream_icon": true,
"branch_icon": "",
"fetch_status": false,
"template": "{{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \uF692 {{ .StashCount }}{{ end }}",
"prefix": " \u279C (",
"postfix": ") "
}
},
{
"type": "node",
"style": "powerline",
"powerline_symbol": "\uE0B0",
"foreground": "#ffffff",
"background": "#86BBD8",
"properties": {
"prefix": " \uE718 "
}
},
{
"type": "time",
"style": "diamond",
"trailing_diamond": "\uE0B0",
"foreground": "#ffffff",
"background": "#33658A",
"properties": {
"prefix": " \u2665 ",
"time_format": "15:04"
}
}
]
}
]
}
code $PROFILE
파일이 열렸다면 아래와 같이 코드를 추가해주자.
$Env:Path += ";C:\Users\ddochea\AppData\Local\Programs\oh-my-posh\bin" # oh-my-posh가 설치된 경로. vscode 용도. 설치 과정에서 추가가 안될때 사용
oh-my-posh --init --shell pwsh --config $HOME/.mytheme.omp.json | Invoke-Expression
그 뒤 새로운 터미널을 열어 파워셸을 실행하면, 대부분 처음 설치하는 사람들은 아래와 같이 글자가 깨진 것처럼 나오게 될 것이다.
이 문제를 해결하기 위해선 폰트를 설치해야 한다.
https://www.nerdfonts.com/
설치가 완료되면 깨짐이 해결된다.
설정이 되면 VSCode에서도 터미널과 동일한 적용상태를 확인할 수 있다.