-
-
Save schmir/4ceefb8d7d27a4b230fd760fd4ab4cc7 to your computer and use it in GitHub Desktop.
show git status on tab key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When Tab is pressed on an empty(!) command line, the contents of the | |
# directory are printed (`ls`) instead of a menu list of all | |
# executables: | |
function my-hg-report() { | |
tip=$(hg tip 2> /dev/null) || return | |
echo | |
hg --config pager.pager= status | |
echo | |
hg --config pager.pager= log --limit 5 --style compact | |
} | |
function my-git-report() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo "------------------------------------------------------------" | |
git status | |
echo "------------------------------------------------------------" | |
git log --pretty=tformat:"%ae %ci%C(bold)%d%Creset%n%h: %s%n" -3 --color |cat | |
echo | |
} | |
function complete-or-list() { | |
if [[ $#BUFFER == 0 ]]; then | |
echo | |
ls -F | |
my-git-report || my-hg-report | |
zle reset-prompt | |
else | |
zle expand-or-complete | |
fi | |
} | |
zle -N complete-or-list | |
bindkey '^I' complete-or-list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment