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:
@@ -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 #
|
||||||
#########
|
#########
|
||||||
|
|||||||
Reference in New Issue
Block a user