본문 바로가기
카테고리 없음

(ZSH) Prezto + zplug로 플러그인 관리하기

by Z0e 2025. 3. 14.

 

 

 

관련 포스팅

 

 

 

 

개요

최적의 ZSH 사용을 위해 `prezto` 프레임워크와 함께 플러그인 매니저를 `zplug`을 사용하려고 한다.

`zplug`는 `prezto`의 기본 플러그인 외에도 다른 플러그인을 추가할 수 있고, 병렬 설치로 빠른 플러그인 관리가 가능하다.

 

 

 

ZSH + Prezto

 

Zsh + Prezto + Nerd Font 설정

ZSH`zsh`은 디폴트 shell인 `bash`를 확장하여 개발한 shell로 자동 완성, 다양한 플러그인 등을 지원한다. 설치sudo apt install zsh  실행`.zshrc` 파일을 생성해준다.zsh shell 변경chsh -s $(which zsh) 사용중인

sohee-zoe.tistory.com

 

configuration

`~/.zpreztorc` 파일에서 Prezto 자체 모듈을 설정한다.

vi ~/.zpreztorc
zstyle ':prezto:load' pmodule \
  'environment' \
  'terminal' \
  'editor' \
  'history' \
  'directory' \
  'spectrum' \
  'utility' \
  'completion' \
  'history-substring-search' \
  'prompt' \
  'autosuggestions' \
  'ssh' \
  'tmux' \
  'ruby' \
  'rails'
source ~/.zpreztorc

 

 

 

 

zplug

zplug

 

GitHub - zplug/zplug: :hibiscus: A next-generation plugin manager for zsh

:hibiscus: A next-generation plugin manager for zsh - zplug/zplug

github.com

 

installation

curl -sL --proto-redir -all,https https://raw.githubusercontent.com/zplug/installer/master/installer.zsh | zsh

 

 

configuration

`~/.zshrc` 파일 상단에 prezto 초기화 후 zplug 설정을 추가한다.

prezto 자체 모듈과 zplug의 플러그인이 중복되는 기능이 없도록 한다. 중복되는 기능은 prezto 모듈을 우선 사용한다.

sudo vi ~/.zshrc
# Source Prezto.
if [[ -s "${ZDOTDIR:-$HOME}/.zprezto/init.zsh" ]]; then
  source "${ZDOTDIR:-$HOME}/.zprezto/init.zsh"
fi

# Set Zplug
export ZPLUG_HOME=$HOME/.zplug
source "$ZPLUG_HOME/init.zsh"


######################## zplug ####################
# oh-my-zsh plugins
#zplug "lib/completion",   from:oh-my-zsh
zplug "lib/key-bindings", from:oh-my-zsh
#zplug "lib/directories",  from:oh-my-zsh
#zplug "lib/history", from:oh-my-zsh

zplug "plugins/git", from:oh-my-zsh
zplug "plugins/git-extras", from:oh-my-zsh
zplug "plugins/colorize", from:oh-my-zsh
zplug "plugins/cp", from:oh-my-zsh
zplug "plugins/docker", from:oh-my-zsh, if:"(( $+commands[docker] ))"
zplug "plugins/docker-compose", from:oh-my-zsh
zplug "plugins/vscode", from:oh-my-zsh
zplug "plugins/fzf", from:oh-my-zsh
zplug "plugins/sudo", from:oh-my-zsh 
# zplug "plugins/autojump", from:oh-my-zsh, frozen:1

#zplug "zsh-users/zsh-completions",              defer:0
#zplug "zsh-users/zsh-autosuggestions",          defer:1, on:"zsh-users/zsh-completions"
#zplug "zsh-users/zsh-syntax-highlighting",      defer:1, on:"zsh-users/zsh-autosuggestions"
#zplug "zsh-users/zsh-history-substring-search", defer:2, on:"zsh-users/zsh-syntax-highlighting"

#zplug "djui/alias-tips"
zplug "zdharma-continuum/fast-syntax-highlighting", defer:2
zplug "MichaelAquilina/zsh-autoswitch-virtualenv", defer:3, hook-load:'export AUTOENV_ENABLE_LEAVE=1'
zplug "mrowa44/emojify", as:"command" 
# zplug "denysdovhan/spaceship-prompt", use:spaceship.zsh, from:github, as:theme


if ! zplug check --verbose; then
  zplug install
fi

zplug load
######################## zplug ####################


# fzf 키 바인딩
source /usr/share/doc/fzf/examples/key-bindings.zsh
source ~/.zshrc

 

 

중복 모듈은 아래 명령어로 확인할 수 있다.

comm -12 <(echo ${(F)modules} | tr ' ' '\n' | sort) <(zplug list | awk '{print $1}' | sort)

 

 

셸 시작 시간 측정

time zsh -i -c exit

# 3회 실시
for i in {1..3}; do time zsh -i -c exit; done