https://www.tobonyblog.com/2024/01/oh-my-posh-windows-install-customize.html
https://www.tobonyblog.com/2024/03/ubuntu-install-oh-my-posh.html
https://ohmyposh.dev/docs/installation/macos
터미널을 자기가 원하는 대로 설정하는 "oh-my-posh"는 편리하지만 처음에는 어떻게 설정해야 하나 헷갈리는 경우가 있습니다. 또 한번 설정하면 좀처럼 변경할 일이 없기 때문에 시간이 지나면 그 설치와 본인의 세팅값을 잊어버리는 경우가 많습니다.
윈도우 터미널과 다르게 맥os는 다음 경로에 관련 파일을 자동다운 받습니다. 홈페이지 설명으로는 찾기가 힘듭니다.
mkdir ~/.oh-my-posh
cd ~/.oh-my-posh/
그래서 처음 설정 후, "사용자 설정"을 하려면 폴더를 별도 설정해야 하나 다양하게 사용하려면 위 기본폴더에 다른 파일을 생성해서 사용하는 것도 괜찮습니다.
저는 공식 홈페이지에서 자주 사용하는 "cobalt2", "powerlevel10k_lean" 테마를 다운받았습니다.
그리고 사용자 설정을 위해서 "powerlevel10k_lean_my.omp.json" 파일을 하나 복사본 만듭니다.
mkdir -p ~/.oh-my-posh && \
curl -o ~/.oh-my-posh/cobalt2.omp.json https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/cobalt2.omp.json && \
curl -o ~/.oh-my-posh/powerlevel10k_lean.omp.json https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/powerlevel10k_lean.omp.jsoncp ~/.oh-my-posh/powerlevel10k_lean.omp.json \
~/.oh-my-posh/powerlevel10k_lean_my.omp.json
sudo nano ~/.oh-my-posh/powerlevel10k_lean_my.omp.json그리고 nano 편집기로 복사한 파일을 열어서 설정을 변경합니다.
저는 명령어를 입력한 "time stamp"가 찍히는 것이 싫어서 이 부분을 삭제 했습니다.
sudo nano ~/.zshrc
# 아래 문구를 삽입하거나 기존 문구에 --config 항목으로 조금 전 설정한 파일경로를 지정합니다.
eval "$(oh-my-posh init zsh --config ~/.oh-my-posh/powerlevel10k_lean_my.omp.json)"source ~/.zshrc사용자가 설정한 터미널 설정으로 화면이 변경됩니다.
#python 가상환경 표시
위 사항에 (.venv) 표시되는 파이썬 가상환경 활성화 부분도 추가하면 아래 코드를 사용하면 됩니다.
"segments": [
{
"foreground": "#A7C7E7",
"style": "plain",
"template": "({{ .Venv }}) ",
"type": "python",
"options": {
"fetch_virtual_env": true,
"fetch_version": false,
"display_mode": "environment"
}
},
{
"foreground": "#77E4F7",
"options": {
"style": "full"
},
"style": "plain",
"template": "{{ .Path }} ",
"type": "path"
},
{
"foreground": "#FFE700",
"style": "plain",
"template": "{{ .HEAD }} ",
"type": "git"
},
{
"foreground": "#43D426",
"style": "plain",
"template": "❯ ",
"type": "text"
}
]
0 댓글