본문 바로가기

Linux

Ubuntu(WSL) Zsh 설치 및 테마, 편한 플러그인 설정

반응형

* WSL 설치방법

참고

https://learn.microsoft.com/ko-kr/windows/wsl/install

 

Powershell 관리자 모드로 실행 후

wsl --install

실행 후 컴퓨터 재부팅

 

 

1. Zsh 설치

# install zsh
sudo apt install zsh

# Change to Basic shell
chsh -s $(which zsh)

 

완료 후 다시 쉘 실행시 아래 안내문이 나오게 된다.

This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~).  This function can help you with a few settings that should
make your use of the shell easier.

You can:

(q)  Quit and do nothing.  The function will be run again next time.

(0)  Exit, creating the file ~/.zshrc containing just a comment.
     That will prevent this function being run again.

(1)  Continue to the main menu.

(2)  Populate your ~/.zshrc with the configuration recommended
     by the system administrator and exit (you will need to edit
     the file by hand, if so desired).

--- Type one of the keys in parentheses ---

 

이때 2 입력

 

2. oh my zsh 설치

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

 

3. zsh 테마 'Powerlevel10k' 설치

참고

https://github.com/romkatv/powerlevel10k?tab=readme-ov-file#meslo-nerd-font-patched-for-powerlevel10k

 

3-1. 폰트설치

  1. Download these four ttf files:

4개 모두 설치 

 

3-2. 사용하는 터미널에 폰트 적용

* 글쓴이는 '윈도우터미널'을 사용하기에 본인에 맞는 터미널 사용방법은 따로 찾아서 적용하시기 바랍니다.

 

설정 클릭 후 'Json 파일 열기'

 

내용 중 중간에 profiles 부분의 defaults 에 font명 넣기

"profiles": 
    {
        "defaults": {
            "fontFace": "MesloLGS NF"
        },

 

 

3-3. powerlevel10k 테마 설치

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

 

vi ~/.zshrc

ZSH_THEME="powerlevel10k/powerlevel10k"

 

source ~/.zshrc

 

3-4. 마지막 명령어 이후 이제 zshrc 설정

   This is Powerlevel10k configuration wizard. You are seeing it because you haven't
  defined any Powerlevel10k configuration options. It will ask you a few questions and
                                 configure your prompt.

                    Does this look like a diamond (rotated square)?
                      reference: https://graphemica.com/%E2%97%86

                                     --->    <---

(y)  Yes.

(n)  No.

(q)  Quit and do nothing.

Choice [ynq]:

 

이런식으로 계속 질문 할텐데 지금은 폰트가 깨졌지만 터미널에서 마름모로 잘 보이면 폰트적용까지 잘 된겁니다.

취향에따라 이제 설정하시면 되겠습니다.

글쓴이는 다음과같이 설정 했습니다(style부분부터)

3121522213221n1y

 

완료된 모습

 

4. 다양한 플러그인 설치

4-1. zsh-autosuggestions

명령어 자동완성

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

이후 

vi ~/.zshrc

plugins=(
        zsh-autosuggestions
)

 

4-2. zsh-syntax-highlighting

커맨 색깔처리

git clone https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions

이후 

vi ~/.zshrc

plugins=(
        zsh-syntax-highlighting
)

 

4-3. fzf 

리눅스버전의 파일검색기

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

사용법 정리

ctrl+r : 히스토리

ctrl+t : 현재위치 기준 파일보기

 

4-4. autojump

한번에 디렉토리를 넘나들 수 있음

# 설치
sudo apt-get update
sudo apt-get install autojump

# 플러그인 적용
vi ~/.zshrc

...
plugins=(

		autojump
)
...

# 적용
source ~/.zshrc

 

사용법

# ~/home/jamy/room 경우

j room

한번 이라도 방문은 해야함

반응형