본문으로 건너뛰기

zsh

설치

sudo pacman -S zsh
chsh -s $(which zsh)

starship

sudo pacman -S ttf-meslo-nerd
curl -sS https://starship.rs/install.sh | sh

플러그인

ZSH_PLUGINS_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins \
&& mkdir -p $ZSH_PLUGINS_DIR \
&& git clone https://github.com/zsh-users/zsh-completions.git $ZSH_PLUGINS_DIR/zsh-completions \
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH_PLUGINS_DIR/zsh-syntax-highlighting \
&& git clone https://github.com/zsh-users/zsh-autosuggestions $ZSH_PLUGINS_DIR/zsh-autosuggestions

.zshrc

~/.zshrc
is_installed() {
[ -n "$(command -v "$1" 2>/dev/null)" ]
}

######################
# User configuration #
######################

# History
HISTFILE=~/.zsh_history
HISTSIZE=10000
SAVEHIST=10000
setopt APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS

export PATH=$PATH:$HOME/.local/bin

# Plugins
ZSH_PLUGINS_DIR=${XDG_DATA_HOME:-$HOME/.local/share}/zsh/plugins

fpath+=$ZSH_PLUGINS_DIR/zsh-completions/src
autoload -Uz compinit && compinit

source $ZSH_PLUGINS_DIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
source $ZSH_PLUGINS_DIR/zsh-autosuggestions/zsh-autosuggestions.zsh

is_installed fzf && eval "$(fzf --zsh)"

git_remove_local_branch () {
git remote update --prune \
&& git switch --detach origin/HEAD \
&& git for-each-ref --format '%(refname:short)' refs/heads | xargs -r -t git branch -D
}

# 마지막 줄
eval "$(starship init zsh)"