Skip to content

Instantly share code, notes, and snippets.

@dedeibel
Created October 8, 2019 12:53
Show Gist options
  • Save dedeibel/ff11eed932b37dd9b34da5c248fb0a72 to your computer and use it in GitHub Desktop.
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
# 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