90 lines
2.4 KiB
Bash
90 lines
2.4 KiB
Bash
LOCAL_GIT_DIR=${HOME}/.local/git
|
|
|
|
alias ga='git add .; git commit --no-edit --amend; git push --force-with-lease'
|
|
alias gae='git add .; git commit --amend; git push --force-with-lease'
|
|
gd() {
|
|
curr_branch=$(git symbolic-ref --short -q HEAD)
|
|
if [ $curr_branch = "master" ]; then
|
|
echo "On master, aborting."
|
|
return
|
|
fi
|
|
git checkout master
|
|
git branch -D ${curr_branch}
|
|
git pull
|
|
}
|
|
alias gl="git log --graph --abbrev-commit --date=short --pretty=format:'%Cred%h%Creset %Cgreen%cr%Creset: %s : %C(bold blue)%an%Creset %C(yellow)%d%Creset'"
|
|
alias less='less -R'
|
|
|
|
if [[ $(command -v bat) ]]; then
|
|
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
|
|
fi
|
|
|
|
if [[ $(command -v curlie) ]]; then
|
|
alias curl=curlie
|
|
fi
|
|
|
|
if [[ $(command -v eza) ]]; then
|
|
alias ls='eza --git --octal-permissions --no-permissions --group-directories-first'
|
|
alias ll='eza --git --octal-permissions --no-permissions --group-directories-first -l'
|
|
else
|
|
case $(uname -s) in;
|
|
Darwin) alias ls='ls -G';;
|
|
Linux) alias ls='ls --color';;
|
|
esac
|
|
alias ll='ls -l'
|
|
fi
|
|
|
|
if [[ $(command -v fd) ]]; then
|
|
if [[ -f ~/.local/config/fd ]]; then
|
|
alias fd='fd -H -L --ignore-file ~/.local/config/fd'
|
|
else
|
|
alias fd='fd -H -L'
|
|
fi
|
|
fi
|
|
|
|
if [ $(command -v nvim) ]; then
|
|
vim() {
|
|
nvim $*; printf "\e[6 q"
|
|
}
|
|
vimdiff() {
|
|
nvim -d $*; printf "\e[6 q"
|
|
}
|
|
export EDITOR=nvim
|
|
export MANPAGER="nvim +Man!"
|
|
elif [ $(command -v vim) ] ; then
|
|
export EDITOR=vim
|
|
else
|
|
export EDITOR=vi
|
|
fi
|
|
|
|
if [[ $(command -v rg) ]]; then
|
|
alias grep='rg -i'
|
|
else
|
|
alias grep='grep --color'
|
|
fi
|
|
|
|
function ud() {
|
|
for i in ${LOCAL_GIT_DIR}/dotfiles ${LOCAL_GIT_DIR}/zsh_modules/*; do git -C ${i} pull; done
|
|
. "${LOCAL_GIT_DIR}/dotfiles/scripts/post-update.sh"
|
|
}
|
|
|
|
function upgrade() {
|
|
if [ $(uname -s) = "Darwin" ]; then
|
|
brew update && brew upgrade && brew upgrade --cask --greedy && brew cleanup
|
|
rm -rf ~/Library/Caches/Homebrew/*
|
|
elif [ $(uname -s) = "FreeBSD" ]; then
|
|
pkg update -f
|
|
pkg upgrade
|
|
freebsd-update fetch
|
|
freebsd-update install
|
|
rm -rf /var/cache/pkg/* /usr/ports/distfiles/*
|
|
pkg audit -F
|
|
else
|
|
case $(lsb_release -si 2>/dev/null) in
|
|
Gentoo) eix-sync && eix-update && emerge -avuNDU @world ;;
|
|
Ubuntu) apt update && apt upgrade ;;
|
|
VoidLinux) xbps-install -Su && xbps-remove -RoO && xlocate -S && du -sh /var/cache/xbps && rm -rf /var/cache/xbps/* ;;
|
|
esac
|
|
fi
|
|
}
|