dotfiles/config/zsh/aliases.zsh

90 lines
2.4 KiB
Bash
Raw Normal View History

LOCAL_GIT_DIR=${HOME}/.local/git
2022-06-27 10:47:21 +02:00
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'
2024-07-02 16:00:44 +02:00
gd() {
curr_branch=$(git symbolic-ref --short -q HEAD)
2024-10-08 12:33:04 +02:00
if [ $curr_branch = "master" ]; then
echo "On master, aborting."
return
fi
2024-07-02 16:00:44 +02:00
git checkout master
git branch -D ${curr_branch}
git pull
}
2024-10-08 12:33:04 +02:00
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'"
2022-10-04 14:56:23 +02:00
alias less='less -R'
2022-06-24 17:01:48 +02:00
2023-05-03 01:34:27 +02:00
if [[ $(command -v bat) ]]; then
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
2023-05-03 01:34:27 +02:00
fi
2024-12-16 13:56:43 +01:00
if [[ $(command -v curlie) ]]; then
alias curl=curlie
fi
2023-09-11 17:45:51 +02:00
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'
2021-03-31 17:35:33 +02:00
else
case $(uname -s) in;
Darwin) alias ls='ls -G';;
Linux) alias ls='ls --color';;
esac
alias ll='ls -l'
fi
2023-05-03 01:34:27 +02:00
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
2023-05-03 01:34:27 +02:00
if [ $(command -v nvim) ]; then
2024-12-30 10:29:42 +01:00
vim() {
nvim $*; printf "\e[6 q"
}
2024-12-30 10:29:42 +01:00
vimdiff() {
nvim -d $*; printf "\e[6 q"
}
2024-12-30 10:29:42 +01:00
export EDITOR=nvim
export MANPAGER="nvim +Man!"
elif [ $(command -v vim) ] ; then
export EDITOR=vim
else
export EDITOR=vi
fi
2023-05-03 01:34:27 +02:00
if [[ $(command -v rg) ]]; then
alias grep='rg -i'
else
alias grep='grep --color'
fi
2021-08-02 17:17:22 +02:00
2021-08-02 17:18:13 +02:00
function ud() {
for i in ${LOCAL_GIT_DIR}/dotfiles ${LOCAL_GIT_DIR}/zsh_modules/*; do git -C ${i} pull; done
2024-10-15 00:44:53 +02:00
. "${LOCAL_GIT_DIR}/dotfiles/scripts/post-update.sh"
2021-08-02 17:17:22 +02:00
}
function upgrade() {
2024-12-11 23:45:47 +01:00
if [ $(uname -s) = "Darwin" ]; then
brew update && brew upgrade && brew upgrade --cask --greedy && brew cleanup
2024-12-11 23:45:47 +01:00
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
2024-12-29 00:26:00 +01:00
case $(lsb_release -si 2>/dev/null) in
2024-08-06 02:05:38 +02:00
Gentoo) eix-sync && eix-update && emerge -avuNDU @world ;;
2024-12-29 00:26:00 +01:00
Ubuntu) apt update && apt upgrade ;;
2024-11-17 00:03:16 +01:00
VoidLinux) xbps-install -Su && xbps-remove -RoO && xlocate -S && du -sh /var/cache/xbps && rm -rf /var/cache/xbps/* ;;
2024-08-06 02:05:38 +02:00
esac
fi
2024-10-25 23:02:02 +02:00
}