1
0
mirror of https://github.com/tiyn/dotfiles.git synced 2025-11-22 22:09:45 +01:00

zsh: added master->main widget

This commit is contained in:
2025-11-15 04:05:04 +01:00
parent 302b3a240e
commit 34ac139b0d

View File

@@ -81,6 +81,26 @@ function +vi-git-stash() {
fi fi
} }
##################
# CUSTOM WIDGETS #
##################
_git_fix_master_main() {
if [[ $BUFFER == git\ * ]]; then
if [[ $BUFFER == *" master"* ]]; then
if git rev-parse --verify main >/dev/null 2>&1 \
&& ! git rev-parse --verify master >/dev/null 2>&1; then
BUFFER=${BUFFER//" master"/" main"}
fi
fi
fi
zle accept-line
}
zle -N _git_fix_master_main
bindkey "^M" _git_fix_master_main
######### #########
# STYLE # # STYLE #
######### #########