Skip to main content

zsh & utility


Installation​

sudo apt install -y git zsh curl \
&& chsh -s $(which zsh) \
&& sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-completions \
${ZSH_CUSTOM:=~/.oh-my-zsh/custom}/plugins/zsh-completions \
&& git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git \
${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
.zshrc
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="powerlevel10k/powerlevel10k"

zstyle '"':omz:update'"' mode auto
zstyle '"':omz:update'"' frequency 13 # in days

DISABLE_UNTRACKED_FILES_DIRTY="true"

plugins=(
git
zsh-completions
zsh-syntax-highlighting
zsh-autosuggestions
)

source $ZSH/oh-my-zsh.sh
autoload -U compinit && compinit

# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

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

# User configuration

# export

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

# alias

if is_installed rsync; then
alias cp="rsync -h --info=progress2"
fi
wget https://github.com/romkatv/dotfiles-public/raw/master/.local/share/fonts/NerdFonts/MesloLGS%20NF%20Regular.ttf

Install MesloLGS NF Regular.ttf

p10k configure

Utility​

tldr​

https://github.com/tldr-pages/tldr

python3 -m pip install tldr
tldr <command>

<command> 의 λͺ‡ 가지 μ‚¬μš© 예제λ₯Ό λ³Ό 수 μžˆμŠ΅λ‹ˆλ‹€.

fzf​

https://github.com/junegunn/fzf

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf \
&& ~/.fzf/install
.zshrc
export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'

# fdfindλ₯Ό μ‚¬μš©ν•˜λŠ” 경우
export FZF_DEFAULT_COMMAND='fd --type f --follow' # --hidden --exclude .git
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"

경둜λ₯Ό μ™„μ„±ν•  λ•Œ **<Tab>을 μ‚¬μš©ν•˜λ©΄ ν•˜μœ„ 경둜 검색이 κ°€λŠ₯ν•©λ‹ˆλ‹€. 예λ₯Ό λ“€μ–΄ aaa/bbb/ccc/ddd.txtλ₯Ό μ°Ύκ³  μ‹ΆμœΌλ©΄ aaa/**<Tab> 후에 μ›ν•˜λŠ” 파일λͺ…을 νŠΉμ§• 지을 수 μžˆλŠ” λ¬Έμžμ—΄ λͺ‡κ°œλ₯Ό μž…λ ₯ν•˜λ©΄ λ©λ‹ˆλ‹€. Ex) b/c/d λ˜λŠ” c/d.txt λ“±

bat​

https://github.com/sharkdp/bat

sudo apt install bat \
&& sudo update-alternatives --install /usr/local/bin/bat bat `which batcat` 1
.zshrc
alias cat="bat -p --paging=never"

fd​

https://github.com/sharkdp/fd

sudo apt-get install fd-find \
&& sudo update-alternatives --install /usr/local/bin/fd fd `which fdfind` 1

ripgrep(rg)​

https://github.com/BurntSushi/ripgrep

sudo apt-get install ripgrep
info

/usr/.crates2.json κ΄€λ ¨ μ—λŸ¬κ°€ λ‚˜λ©΄ sudo apt install -o Dpkg::Options::="--force-overwrite" ripgrep둜 μ‹œλ„ν•΄λ³΄λ©΄ λ©λ‹ˆλ‹€.

lsd​

https://github.com/Peltoche/lsd

wget https://github.com/Peltoche/lsd/releases/download/0.20.1/lsd_0.20.1_amd64.deb \
&& sudo dpkg -i lsd_0.20.1_amd64.deb
alias ls='lsd --icon never'

pet​

https://github.com/knqyf263/pet

wget https://github.com/knqyf263/pet/releases/download/v0.4.0/pet_0.4.0_linux_amd64.deb \
&& sudo dpkg -i pet_0.4.0_linux_amd64.deb
.zshrc
function pet-select() {
BUFFER=$(pet search --query "$LBUFFER")
CURSOR=$#BUFFER
zle redisplay
}
zle -N pet-select
bindkey '^s' pet-select

<param> or <param=default> κΈ°λŠ₯이 μ’‹κΈ΄ ν•œλ°, < >κ°€ μ‚¬μš©λ˜λŠ” λͺ…령어듀은 νŒŒμ‹±μ΄ μ΄μƒν•˜κ²Œ λ˜λŠ” κ²½μš°κ°€ μžˆμŠ΅λ‹ˆλ‹€. μ‹œκ°„μ΄ 되면 PR...

bpytop​

python3 -m pip install bpytop \
&& sudo update-alternatives --install /usr/local/bin/btop btop `which bpytop` 1