dotfiles/zsh/.aliases
Josh Sherman 19c802aa52
Add tmux config and bring back Neovim
Tmux config seems like it probably solved things. Wondering if I outta
put a line in there to automatically source the tmux config. Still can't
believe I've went this long without needing to muck with the tmux config
at all. I wonder how life will be different now, hopefully better.
2024-06-18 18:56:18 -05:00

88 lines
2.1 KiB
Text

unalias -a
# Safety first
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
# Colorize output, make ls human readable and classify...
if [[ `uname` == Darwin ]]; then
alias dircolors='gdircolors'
alias ls='gls --color=auto -hF'
else
alias ls='ls --color=auto -hF'
# ...and standardize to macOS naming on Linux
alias open='xdg-open'
fi
# Run ls after cd
function cd { builtin cd "$@" && ls }
# Colorize cat with bat
if command -v apt-get &> /dev/null; then
# Debian
alias cat='batcat'
else
# Everybody else
alias cat='bat'
fi
# Disk utility aliases
alias df='df -h'
alias du='du -h'
# Colorize output and some exclusions
alias grep="grep --color=auto --exclude-dir={.git,artwork,node_modules,vendor}"
# Git functions
git_current_branch() {
(command git symbolic-ref -q HEAD || command git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null
}
git_default_branch() {
(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') 2> /dev/null
}
# Git aliases
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gb='git branch'
alias gc='git commit'
alias gca='git commit -a'
alias gcam='git commit -a --amend'
alias gcb='git checkout -b'
alias gcl='git clone'
alias gcm='git checkout $(git_default_branch)'
alias gco='git checkout'
alias fgco='git checkout $(git branch | sed "s/\*//" | fzf)'
alias gd='git diff'
alias gds='git diff --staged'
alias gf='git fetch'
alias gfm='git fetch origin $(git_default_branch):$(git_default_branch)'
alias gl='git pull origin $(git_current_branch)'
alias glg='git log'
alias gm='git merge'
alias gmm='git merge $(git_default_branch)'
alias gmv='git mv'
alias gp='git push origin $(git_current_branch)'
alias gpf='git push origin $(git_current_branch) --force'
alias grb='git rebase'
alias grbm='git rebase $(git_default_branch)'
alias grm='git rm'
alias gst='git status'
# HTTPie aliases
alias GET='http'
alias POST='http POST'
alias HEAD='http HEAD'
# Universally unique identifier (UUID) generator
if [[ `uname` == Darwin ]]; then
alias uuidgen='uuidgen | tr A-F a-f'
fi
# Nvim takeover
alias vim='nvim'
alias vimdiff='nvim -d'