From f2d80ebd2bcf4e58c31dc5f9ca92c0a40573a333 Mon Sep 17 00:00:00 2001 From: Jonas Ryssel Date: Wed, 30 Mar 2022 15:47:39 +0200 Subject: [PATCH] Add git function wrapper Alternative ack alias --- .bash_aliases | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/.bash_aliases b/.bash_aliases index 1c1492c..6b38a3a 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -35,9 +35,10 @@ alias jix-vpn="sudo openvpn --config ~/openvpn/jobindex.conf" alias enable_touch="xinput enable 'Wacom HID 51E3 Finger touch'" alias disable_touch="xinput disable 'Wacom HID 51E3 Finger touch'" alias pacman="nice -n 19 pacman" -alias pamac="nice -n 19 pamac" alias yay="nice -n 19 yay" 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 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.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:'" title() {