dotfiles/.config/zsh/aliases

71 lines
1.7 KiB
Plaintext
Raw Normal View History

2024-10-30 17:06:02 -05:00
# shellcheck disable=SC2148
2024-10-29 22:57:09 -05:00
system_type=$(uname -s)
2024-10-29 18:12:34 -05:00
# aliases
2024-10-31 16:28:02 -05:00
alias less="bat -p"
2024-10-29 18:12:34 -05:00
alias more=less
2024-10-29 22:57:09 -05:00
alias mroe=more
2024-10-29 18:12:34 -05:00
alias tk=take
alias top10="print -l -- \${(o)history%% *} | uniq -c | sort -nr | head -n 10"
alias zsh-plugins="ls \$ZPLUGINDIR"
2024-10-29 22:57:09 -05:00
alias vi=nvim
2024-10-29 18:12:34 -05:00
# git aliases
alias g=git
2024-10-29 22:57:09 -05:00
alias gi=g
alias gg='g grep'
alias gs='g status'
alias gd='g diff'
alias ga='g add'
alias gap='ga -p'
alias gc='g commit'
2024-10-29 23:03:07 -05:00
alias gp='g push'
2024-10-29 18:12:34 -05:00
# YADM aliases
alias y="yadm"
alias ys="y status"
alias ysu="ys -u"
alias yg='y grep'
alias yd='y diff'
2024-10-29 22:57:09 -05:00
alias ya='y add'
alias yap='ya -p'
alias yc='y commit'
2024-10-29 23:03:07 -05:00
alias yp='y push'
2024-10-29 18:12:34 -05:00
# Homebrew aliases
alias b="brew"
alias bi="b info"
alias bin="b install"
2024-10-29 22:57:09 -05:00
alias bu="b uninstall"
alias brm="bu"
2024-10-29 18:12:34 -05:00
alias bs="b search"
2024-10-29 22:57:09 -05:00
alias bv="brew-visit" # a function defined elsewhere
2024-10-29 18:12:34 -05:00
# These depend on some installed packages, so just to be safe
alias ls="ls -F"
[[ "$(command -v lsd)" ]] && alias ls="lsd -F"
2024-12-04 11:45:42 -06:00
# [[ "$(command -v bat)" ]] && alias cat="bat" # unneeded, handled by fdellwing/zsh-bat
2024-10-29 18:12:34 -05:00
[[ "$(command -v htop)" ]] && alias top="htop"
[[ "$(command -v duf)" ]] && alias df="duf"
# Toggle hidden files in Finder
alias showhidden='defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder'
alias hidehidden='defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder'
# For passing github token to gh
alias gh="op plugin run -- gh"
if [ "$system_type" = "Darwin" ]; then
# Open iTerm from VS Code terminal
# May refactor this to make the alias available in all non-iTerm terminals
[ ! -v "$IN_VS_CODE_TERMINAL" ] && alias iterm="open -a iTerm"
fi
2024-10-30 13:35:16 -05:00
if [ -e "${0:a:h}"/aliases.local ]; then
2024-10-31 12:04:41 -05:00
# omg shut up shellcheck
# shellcheck source=/dev/null
2024-10-30 13:35:16 -05:00
source "${0:a:h}"/aliases.local
else
2024-10-31 12:04:41 -05:00
echo "Couldn't find ${0:a:h}/aliases.local!"
2024-10-29 18:12:34 -05:00
fi