Files
dotfiles/.config/zsh/.zshrc

80 lines
2.3 KiB
Bash

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zsh/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Aliases
alias c='clear'
alias open='xdg-open'
alias lg="lazygit"
alias nv="nvim"
alias ts="tmux new-session -A -s"
alias tl="tmux ls"
alias lyadm="lazygit --work-tree ~ --git-dir ~/.local/share/yadm/repo.git"
alias jyadm="just -g"
# Completions
fpath=($HOME/.zsh/completions $fpath)
autoload -U compinit; compinit
_comp_options+=(globdots) # With hidden
# Load antidote & plugins
source ${ZDOTDIR}/antidote/antidote.zsh
antidote load
# fzf keybindings
if type rg &> /dev/null; then
export FZF_DEFAULT_COMMAND='rg --files'
export FZF_DEFAULT_OPTS='-m --height 50% --border'
fi
if [ -d /usr/share/doc/fzf ]; then
source /usr/share/doc/fzf/examples/completion.zsh
source /usr/share/doc/fzf/examples/key-bindings.zsh
fi
# ----------------- Replacement for standard tools ----------------- #
# ls -> eza aliases
# https://gist.github.com/AppleBoiy/04a249b6f64fd0fe1744aff759a0563b
# TODO: https://denisrasulev.medium.com/eza-the-best-ls-command-replacement-9621252323e
if [ "$(command -v eza)" != "" ]; then
alias ls='eza'
alias l='eza -lbF --git'
alias ll='eza -lbGF --git'
alias llm='eza -lbGd --git --sort=modified'
alias la='eza -lbhHigUmuSa --time-style=long-iso --git --color-scale'
alias lx='eza -lbhHigUmuSa@ --time-style=long-iso --git --color-scale'
# specialty views
alias lS='eza -1'
alias lt='eza --tree --level=2'
alias l.="eza -a | grep -E '^\.'"
fi
# cd -> zoxide
if [ "$(command -v zoxide)" != "" ]; then
eval "$(zoxide init zsh)"
alias cd="z"
alias cdi="zi"
fi
# man -> tldr
# No alias
# cat -> bat
if [ "$(command -v bat)" != "" ]; then
export BAT_THEME="base16"
export BAT_STYLE="numbers,changes,header"
alias cat="bat"
alias -g -- -h='-h 2>&1 | bat --language=help --style=plain'
fi
# direnv hook
if [ "$(command -v direnv)" != "" ]; then
eval "$(direnv hook zsh)"
fi
# To customize prompt, run `p10k configure` or edit ~/.zsh/.p10k.zsh.
[[ ! -f "$ZDOTDIR/.p10k.zsh" ]] || source $ZDOTDIR/.p10k.zsh