Created
October 8, 2019 12:53
-
-
Save dedeibel/ff11eed932b37dd9b34da5c248fb0a72 to your computer and use it in GitHub Desktop.
zsh widget that executes a git or svn log command and can be bound to a key combination
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
# Save as ~/.zsh/function/vcs_log | |
# | |
# In your ~/.zshrc | |
# | |
# fpath=(~/.zsh/function $fpath) | |
# autoload vcs_log | |
# zle -N vcs_log | |
# # Bind to Alt+g | |
# bindkey '\eg' vcs_log | |
function vcs_log { | |
# zle -U does not work since it is only executed after the widget | |
if (svn info 2> /dev/null > /dev/null); then | |
BUFFER="svn log -l 7" | |
else | |
BUFFER="git --no-pager log --oneline --graph --decorate --all -20" | |
fi | |
zle accept-line | |
true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment