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 추가

#폴더이동 및 메모장 열기
cd ~\AppData\Local\Programs\oh-my-posh\themes
notepad powerlevel10k_lean_my.omp.json
 
#
{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "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"
    }
  },
        {
          "properties": {
            "cache_duration": "none",
            "style": "full"
          },
          "template": "{{ .Path }} ",
          "foreground": "#77E4F7",
          "type": "path",
          "style": "plain"
        },
        {
          "properties": {
            "cache_duration": "none"
          },
          "template": "{{ .HEAD }} ",
          "foreground": "#FFE700",
          "type": "git",
          "style": "plain"
        },
        {
          "properties": {
            "cache_duration": "none"
          },
          "template": "❯ ",
          "foreground": "#43D426",
          "type": "text",
          "style": "plain"
        }
      ]
    }
  ],
  "version": 3
}



댓글 쓰기 · 수정

0 댓글