From 3f4d5fac0c10fafd1eb6581a73b78df23a88a186 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Mon, 1 Oct 2012 22:26:24 -0400 Subject: [PATCH] Add zstyles for git-log formats --- modules/git/alias.zsh | 24 ++++++++++++++---------- modules/git/functions/git-commit-lost | 2 +- modules/git/functions/git-stash-dropped | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/git/alias.zsh b/modules/git/alias.zsh index f67dd69c..8d84d923 100644 --- a/modules/git/alias.zsh +++ b/modules/git/alias.zsh @@ -10,6 +10,14 @@ # # +# Log +zstyle -s ':prezto:module:git:log:medium' format '_git_log_medium_format' \ + || _git_log_medium_format='%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B' +zstyle -s ':prezto:module:git:log:oneline' format '_git_log_oneline_format' \ + || _git_log_oneline_format='%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n' +zstyle -s ':prezto:module:git:log:brief' format '_git_log_brief_format' \ + || _git_log_brief_format='%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n' + # Status zstyle -s ':prezto:module:git:status:ignore' submodules '_git_status_ignore_submodules' \ || _git_status_ignore_submodules='none' @@ -91,16 +99,12 @@ alias gCt='git checkout --theirs --' alias gCT='gCt $(gCl)' # Log (l) -git_log_format_medium='--pretty=format:%C(bold)Commit:%C(reset) %C(green)%H%C(red)%d%n%C(bold)Author:%C(reset) %C(cyan)%an <%ae>%n%C(bold)Date:%C(reset) %C(blue)%ai (%ar)%C(reset)%n%+B' -git_log_format_oneline='--pretty=format:%C(green)%h%C(reset) %s%C(red)%d%C(reset)%n' -git_log_format_brief='--pretty=format:%C(green)%h%C(reset) %s%n%C(blue)(%ar by %an)%C(red)%d%C(reset)%n' - -alias gl='git log --topo-order ${git_log_format_medium}' -alias gls='git log --topo-order --stat ${git_log_format_medium}' -alias gld='git log --topo-order --stat --patch --full-diff ${git_log_format_medium}' -alias glo='git log --topo-order ${git_log_format_oneline}' -alias glg='git log --topo-order --all --graph ${git_log_format_oneline}' -alias glb='git log --topo-order ${git_log_format_brief}' +alias gl='git log --topo-order --pretty=format:${_git_log_medium_format}' +alias gls='git log --topo-order --stat --pretty=format:${_git_log_medium_format}' +alias gld='git log --topo-order --stat --patch --full-diff --pretty=format:${_git_log_medium_format}' +alias glo='git log --topo-order --pretty=format:${_git_log_oneline_format}' +alias glg='git log --topo-order --all --graph --pretty=format:${_git_log_oneline_format}' +alias glb='git log --topo-order --pretty=format:${_git_log_brief_format}' alias glc='git shortlog --summary --numbered' # Merge (m) diff --git a/modules/git/functions/git-commit-lost b/modules/git/functions/git-commit-lost index 0984ab92..e4075c9b 100644 --- a/modules/git/functions/git-commit-lost +++ b/modules/git/functions/git-commit-lost @@ -17,5 +17,5 @@ git fsck 2> /dev/null \ --date-order \ --no-walk \ --stdin \ - ${git_log_format_oneline} + --pretty=format:${_git_log_oneline_format} diff --git a/modules/git/functions/git-stash-dropped b/modules/git/functions/git-stash-dropped index 9867ad04..26229263 100644 --- a/modules/git/functions/git-stash-dropped +++ b/modules/git/functions/git-stash-dropped @@ -14,7 +14,7 @@ git fsck --unreachable 2> /dev/null \ | grep 'commit' \ | awk '{print $3}' \ | git log \ - ${git_log_format_oneline} \ + --pretty=format:${_git_log_oneline_format} \ --extended-regexp \ --grep="${1:-(WIP )?[Oo]n [^:]+:}" \ --merges \