예쁜 터미널은 개발자의 마음에 안식을 가져다 줍니다. 매번 개발 환경을 설정할 때마다 새로 찾아보기가 번거로운데 이 기회에 정리합니다.
oh-my-zsh 설치
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
플러그인 설치
# zsh-syntax-highlighting
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
# zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions
Powerlevel10k 테마 설치
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k
~/.zshrc 수정
# 플러그인 지정
plugins=(
git
zsh-syntax-highlighting
zsh-autosuggestions
)
# 테마 선택
ZSH_THEME="powerlevel10k/powerlevel10k"
이제 zshrc를 다시 로드하면 powerlevel10k가 interactive 하기 쉘 설정을 한 단계씩 물어봅니다.
잘 대답해줍니다. 끝.
트러블슈팅
Q. 다 설정했는데 프롬프트에 물음표 박스가 떠요.
A. 폰트를 설치하고 'Meslo LG L for Powerlevel10k' 로 지정해주세요.
# clone
git clone https://github.com/powerline/fonts.git --depth=1
# install
cd fonts
./install.sh
# clean-up a bit
cd ..
rm -rf fonts
Q. "prompt_context:2: command not found: prompt_segment" 에러가 떠요
A. ~/.zshrc 파일에서 prompt_context 를 오버라이드하면 아니되어요. 다음을 추가해주세요.
prompt_context() {}