oh my zsh + powerlevel10k

Kyojun Jin·2024년 4월 11일

WSL 사용법

목록 보기
2/6

개요

zsh: zshell, 일반 bash shell 확장판. 추가 기능 포함되어 있음
oh my zsh: zshell 의 플러그인, 테마 관리 프레임워크
powerlevel10k: zsh의 테마 중 하나.

설치

주의: WSL에서 사용 시 git에서 Auto CRLF 설정을 끌 것. 그렇지 않으면 추후 필요한 파일들을 클론할 때 CR이 붙여서 받아져서 실행 시 오류가 발생함.
git config –global core.autocrlf false

0. 사전 설치 (옵션)

sudo apt install wget curl git

wget, curl, git 이 없으면 설치

1. zsh 설치

sudo apt update
sudo apt install zsh

2. 쉘 변경

chsh -s $(which zsh)
이거 하고 exit하고 나갔다 들어온다.

들어왔을 때 echo $SHELL 했을 때 /bin/zsh로 출력되면 된다.

아직까진 bash랑 외관적인 차이점이 없다.

환경변수를 ~/.zshrc에서 다시 설정해줘야 한다. /etc/profile/도 안 먹는다.

3. Oh My Zsh 설치

# curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

# wget
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

두 명령어 중 하나를 골라서 설치한다.

4. 폰트 설치

MesloLGS NF Regular.ttf
MesloLGS NF Bold.ttf
MesloLGS NF Italic.ttf
MesloLGS NF Bold Italic.ttf

설치하고, 터미널의 폰트를 바꿔준다.
WSL의 경우 터미널 설정에서 Ubuntu 를 선택한 뒤 추가 설정 > 모양 > 글꼴에서 MesloLGS NF로 변경한다.

sudo apt install fonts-powerline
fonts-powerline 폰트를 설치한다.

5. powerlevel10k 설치

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

이후 vim ~/.zshrc에서 ZSH_THEME="powerlevel10k/powerlevel10k"로 수정한다.

source ~/.zshrc로 설정을 적용한다. 이후 설정을 따른다.

이 설정은 p10k configure 명령어로도 다시 설정할 수 있다.

6. 플러그인 설치

# 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:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# fzf (Fuzzy Finder )
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

zsh-syntax-highlighting 은 구문 하이라이팅이다. 잘못된 명령어 등 하이라이팅 해준다.

zsh-autosuggestion은 명령어나 폴더 이름을 알아서 써준다.

fzf는 히스토리, 이름 기반 디렉토리 탐색기이다.

zshrc 들어가서 plugins=(git)이라고 돼있는 것에 각 플러그인의 이름을 추가해준다.

이후 source ~/.zshrc

7. 색깔 커스터마이징

for i in {0..255}; do print -Pn "%K{$i} %k%F{$i}${(l:3::0:)i}%f " ${${(M)$((i%6)):#3}:+$'\n'}; done

이걸 복사해서 shell에 입력하면 0~255별 색이 나온다.

zshrc에 들어가서 _BACKGROUND로 배경을, _FOREGROUND로 색을 지정할 수 있다.

탭 분할해서 오른쪽에 색깔표를 띄우고 왼쪽에서 색을 바꿔주면 된다.

색을 바꾸면 source ~/.zshrc를 해야 한다.

hex는 안 먹고 0~255 사이 수만 입력 가능하다.

색 말고도 로고별 유니코드도 변경 가능하다.

os_icon
dir

context
time

0개의 댓글