Add git function wrapper

Alternative ack alias
This commit is contained in:
Jonas Ryssel 2022-03-30 15:47:39 +02:00
parent bed13a9660
commit f2d80ebd2b

View File

@ -35,9 +35,10 @@ alias jix-vpn="sudo openvpn --config ~/openvpn/jobindex.conf"
alias enable_touch="xinput enable 'Wacom HID 51E3 Finger touch'" alias enable_touch="xinput enable 'Wacom HID 51E3 Finger touch'"
alias disable_touch="xinput disable 'Wacom HID 51E3 Finger touch'" alias disable_touch="xinput disable 'Wacom HID 51E3 Finger touch'"
alias pacman="nice -n 19 pacman" alias pacman="nice -n 19 pacman"
alias pamac="nice -n 19 pamac"
alias yay="nice -n 19 yay" alias yay="nice -n 19 yay"
alias restartplasma='kquitapp5 plasmashell && kstart5 plasmashell' alias restartplasma='kquitapp5 plasmashell && kstart5 plasmashell'
alias ack="ack -T junkFiles"
function ack_open { nvim $( ack -m 1 -T junkFiles "$@" | grep -Po "^(?:lib|t|tmpl|python)/[^:]+:\d+" | tr '\n' ' ' ); }
# git # git
alias gst="git status" alias gst="git status"
@ -55,6 +56,33 @@ git config --global color.grep.filename "Green"
git config --global color.grep.linenumber "Yellow" git config --global color.grep.linenumber "Yellow"
git config --global color.grep.match "bold #ff4d00" git config --global color.grep.match "bold #ff4d00"
git() {
local subcommand1
local subcommand2
if (( "$#" == 0 )); then command git; return; fi
subcommand1=$1; shift
case $subcommand1 in
stash)
if (( "$#" == 0 )); then command git stash; return; fi
subcommand2=$1; shift
case $subcommand2 in
list)
command git stash list --pretty=format:"%C(bold magenta)%gd%C(reset): %<|(110)%s %C(green)(%cr)" "$@"
;;
*)
command git "$subcommand1" "$subcommand2" "$@"
;;
esac
;;
*)
command git "$subcommand1" "$@"
;;
esac
}
alias TODO="ggn 'TODO: jry:'" alias TODO="ggn 'TODO: jry:'"
title() { title() {