Been playing with new color schemes as I've switched to Alacritty. Ran into a scenario where there was a color scheme for Neovim and not Vim. New color scheme is solid, so my previous color scheme issues are now null and void. Instead of juggling around with a shared configuration, I've committed to a separate configuration for Vim and Neovim.
94 lines
2.6 KiB
Text
94 lines
2.6 KiB
Text
# Starts with a clean slate
|
|
unalias -a
|
|
|
|
# Prompt when doing something destructive
|
|
alias cp='cp -i'
|
|
alias mv='mv -i'
|
|
alias rm='rm -i'
|
|
|
|
# Colorize output, make ls human-readable and add classification indicators
|
|
if [[ `uname` == Darwin ]]; then
|
|
# macOS
|
|
alias dircolors='gdircolors'
|
|
alias ls='gls --color=auto --human-readable --classify'
|
|
|
|
# Force uuidgen to use lowercase letters like Linux
|
|
alias uuidgen='uuidgen | tr A-F a-f'
|
|
else
|
|
# Linux
|
|
alias ls='ls --color=auto --human-readable --classify'
|
|
|
|
# Use the same open command as macOS
|
|
alias open='xdg-open'
|
|
fi
|
|
|
|
# Run ls immediately after cd
|
|
function cd { builtin cd "$@" && ls }
|
|
|
|
# Use bat instead of cat for syntax highlighting
|
|
if command -v apt-get &> /dev/null; then
|
|
# Debian
|
|
alias cat='batcat'
|
|
else
|
|
# Everybody else
|
|
alias cat='bat'
|
|
fi
|
|
|
|
# Make disk utility human-readable
|
|
alias df='df --human-readable'
|
|
alias du='du --human-readable'
|
|
|
|
# Colorize grep output and add some exclusions
|
|
alias grep="grep --color=auto --exclude-dir={.git,artwork,node_modules,vendor}"
|
|
|
|
# Use HTTPie in place of the old libwww-perl commands
|
|
alias GET='http'
|
|
alias POST='http POST'
|
|
alias HEAD='http HEAD'
|
|
|
|
# Use htop instead of boring old top
|
|
alias top='htop'
|
|
|
|
# Get the git branch name for the current directory (used in the prompt)
|
|
git_current_branch() {
|
|
(command git symbolic-ref -q HEAD || command git name-rev --name-only --no-undefined --always HEAD) 2> /dev/null
|
|
}
|
|
|
|
# Get the default branch name for the current directory (usually master or main)
|
|
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 gmt='git merge --strategy-option=theirs'
|
|
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'
|
|
|
|
# Use nvim in place of vim
|
|
alias vim='nvim'
|
|
alias vimdiff='nvim -d'
|