dotfiles/config/zsh/aliases.zsh

83 lines
2.1 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'"
2024-07-02 16:00:44 +02:00
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
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
2024-10-25 23:02:02 +02:00
if [[ $(command -v mosh) ]]; then
alias ssh=mosh
fi
if [ $(command -v nvim) ]; then
export EDITOR=nvim
export MANPAGER="nvim +Man!"
alias vim=nvim
alias vimdiff="nvim -d"
elif [ $(command -v vim) ] ; then
export EDITOR=vim
else
export EDITOR=vi
fi
2024-10-14 21:04:16 +02:00
if [ $(command -v zed) ] && [ $(id -u) -ne 0 ]; then
alias vim=zed
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-08-06 02:05:38 +02:00
if [ $(uname -s) != "Darwin" ]; then
case $(lsb_release -si) in
Gentoo) eix-sync && eix-update && emerge -avuNDU @world ;;
VoidLinux) xbps-install -Su && xbps-remove -RoO && xlocate -S ;;
esac
else
brew update && brew upgrade && brew cleanup
rm -rf ~/Library/Caches/Homebrew/*
2024-08-06 02:05:38 +02:00
fi
oh-my-posh upgrade
2024-10-25 23:02:02 +02:00
}