function _check-if-dotfile-command {
if [[ $BUFFER =~ ^"g d untrack-all" ]]
then
zle .kill-whole-line
BUFFER="g d rm --cached -r ~"
zle .accept-line
elif [[ $BUFFER =~ ^"g d add-and-commit" ]]
then
BUFFERz=$(echo $BUFFER | cut -d '"' -f2)
zle .kill-whole-line
BUFFER="git d add ~ && g d commit -am \"${BUFFERz}\""
zle .accept-line
elif [[ $BUFFER =~ ^"g d sb" ]]
then
zle .kill-whole-line
BUFFER="git d branch | rofi -dmenu | xargs git checkout"
zle .accept-line
elif [[ $BUFFER =~ ^"g d stash-and-reset" ]]
then
zle .kill-whole-line
BUFFER="git d stash && git d reset --hard HEAD"
zle .accept-line
elif [[ $BUFFER =~ ^"g d last" ]]
then
zle .kill-whole-line
BUFFER="git d --no-pager log -1 --oneline"
zle .accept-line
else
zle .accept-line
fi
}
zle -N accept-line _check-if-dotfile-command