Oh-My-posh Windows에서 install, customize terminal 방법

 

winget install JanDeDobbeleer.OhMyPosh




아래 사이트에서 테마를 고르고...

https://ohmyposh.dev/docs/themes

 

Themes | Oh My Posh

Oh My Posh comes with many themes included out-of-the-box. Below are some screenshots of the more common themes.

ohmyposh.dev

etc-image-1
etc-image-2

etc-image-3

etc-image-4

 

 

 

powerlevel10k_lean 으로 설정 

# 처음 설정한다면 설정 파일을 만들면서, 작업하기 위해
new-item -type file -path $profile -force
notepad $PROFILE
 
# 기존 설정을 변경하려면
notepad $PROFILE
 
 
# powerlevel10k_lean 테마설정
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\powerlevel10k_lean.omp.json" | Invoke-Expression
 
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\cobalt2.omp.json" | Invoke-Expression
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\powerline.omp.json" | Invoke-Expression
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\probua.minimal.omp.json" | Invoke-Expression
 
#아래, 커스텀설정 적용시
oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\powerlevel10k_lean_my.omp.json" | Invoke-Expression
 
 
# 혹시 실행시 에러가 있으면 아래로 권한설정
Set-ExecutionPolicy -ExecutionPolicy Unrestricted




아래 원하는 스타일로 명령어를 복사해서 메모장에다 붙여넣고 저장하기




최종 powershell 실행될 때마다, 이렇게 자동적용됨



custom하

그냥 써도 무방하지만 vscode에서 debugging 하거나 실행하다보면, 오른쪽에 실행시간 표시가 된 부분이 2번째줄로 넘어가서 가독성이 떨어진다. 그래서 시간 부분을 제거하고 사용



# powerlevel10k_lean 기반 커스텀설정
 
cd $env:POSH_THEMES_PATH/
cp powerlevel10k_lean.omp.json powerlevel10k_lean_my.omp.json
notepad powerlevel10k_lean_my.omp.json
 
 
cd ~\AppData\Local\Programs\oh-my-posh\themes





파이썬 가상환경표시를 위해, {{ .venv }} block 추가

#폴더이동 및 메모장 열기
oh-my-posh config export --config powerlevel10k_lean --output "$HOME\powerlevel10k_lean_my.omp.json"
notepad powerlevel10k_lean_my.omp.json
 
#
{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "upgrade": {
    "source": "cdn",
    "interval": "168h",
    "auto": false,
    "notice": false
  },
  "blocks": [
    {
      "type": "prompt",
      "alignment": "left",
      "segments": [
        {
          "foreground": "#A7C7E7",
          "style": "plain",
          "template": "({{ .Venv }}) ",
          "type": "python",
          "options": {
            "fetch_virtual_env": true,
            "fetch_version": false,
            "display_mode": "environment"
          }
        },
        {
          "options": {
            "style": "full"
          },
          "template": "{{ .Path }} ",
          "foreground": "#77E4F7",
          "type": "path",
          "style": "plain"
        },
        {
          "template": "{{ .HEAD }} ",
          "foreground": "#FFE700",
          "type": "git",
          "style": "plain"
        },
        {
          "template": "❯ ",
          "foreground": "#43D426",
          "type": "text",
          "style": "plain"
        }
      ]
    }
  ],
  "version": 4
}




1단계 — 테마 내보내기 + 복사본 이름 지정 (한 번에):

oh-my-posh config export --config powerlevel10k_lean --output "$HOME\powerlevel10k_lean_my.omp.json"

2단계 — 프로필 수정:

notepad $PROFILE

init 줄을 이렇게:

oh-my-posh init pwsh --config "$HOME\powerlevel10k_lean_my.omp.json" | Invoke-Expression

3단계(선택) — live reload:

oh-my-posh enable reload

이후 $HOME\powerlevel10k_lean_my.omp.json 을 고치면 프롬프트에 바로 반영됩니다.


댓글 쓰기 · 수정

0 댓글