Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH 1/2] Cleaned up vcs_info-examples "Hooks" section
- X-seq: zsh-workers 28084
- From: Seth House <seth@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH 1/2] Cleaned up vcs_info-examples "Hooks" section
- Date: Thu, 15 Jul 2010 22:34:15 +0000 (UTC)
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
When quickly browsing vcs_info-examples the section delimiters were a
little confusing. Mercurial didn't need it's own section inside of
Hooks, for example. This removes the Mercurial-specific section and adds
an 'hg' or 'git' prefix to each example.
---
Misc/vcs_info-examples | 58 ++++++++++++++++++++++++-----------------------
1 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples
index 742ba34..1c15972 100644
--- a/Misc/vcs_info-examples
+++ b/Misc/vcs_info-examples
@@ -67,29 +67,6 @@ precmd() {
}
-### Hooks ####################################################################
-
-# A number of examples in this file revolve around the concept of `hooks'
-# in vcs_info. Hooks are places in vcs_info where you may put in your
-# own code to achieve something "totally awesome"[tm].
-#
-# Hooks can be confusing. It's hard to keep track of what's going on.
-# In order to help you with that vcs_info can output some debugging
-# information when it processes hooks. This will tell you which hooks
-# are being run and which functions are attempted to run (and if the
-# functions in question were found or not).
-#
-# If you feel like you need to see what's attempted and where, I suggest
-# you use the following line and see for yourself.
-zstyle ':vcs_info:*+*:*' debug true
-
-# You can just comment it out (or disable it) again when you've seen enough.
-# Debugging is off by default - of course.
-zstyle ':vcs_info:*+*:*' debug false
-
-# Further down, every example that uses a function named `+vi-*' uses a hook.
-
-
### check-for-changes just in some places ####################################
# Some backends (git and mercurial at the time of writing) can tell you
@@ -126,21 +103,46 @@ function estyle-cfc() {
}
-### Mercurial Tips #########################################################
+### Hook Examples ############################################################
-### Truncate Long Hashes ####################################################
+# A number of examples in this file revolve around the concept of `hooks'
+# in vcs_info. Hooks are places in vcs_info where you may put in your
+# own code to achieve something "totally awesome"[tm].
+#
+# Hooks can be confusing. It's hard to keep track of what's going on.
+# In order to help you with that vcs_info can output some debugging
+# information when it processes hooks. This will tell you which hooks
+# are being run and which functions are attempted to run (and if the
+# functions in question were found or not).
+#
+# If you feel like you need to see what's attempted and where, I suggest
+# you use the following line and see for yourself.
+zstyle ':vcs_info:*+*:*' debug true
+
+# You can just comment it out (or disable it) again when you've seen enough.
+# Debugging is off by default - of course.
+zstyle ':vcs_info:*+*:*' debug false
+
+# Further down, every example that uses a function named `+vi-*' uses a hook.
+
+
+### Truncate Long Hashes
### Truncate a long hash to 12 characters (which is usually unique enough)
# NOTE: On Mercurial this will hide the second parent hash during a merge
-# (see an example in the Mercurial section below on how to retain both parents)
+# (see an example below on how to retain both parents)
# Use zformat syntax (remember %i is the hash): %12.12i
+# git:
+zstyle ':vcs_info:git*' formats "(%s)-[%12.12i %b]-" # hash & branch
+
+# hg:
# First, remove the hash from the default 'branchformat':
zstyle ':vcs_info:hg:*' branchformat '%b'
# Then add the hash to 'formats' as %i and truncate it to 12 chars:
zstyle ':vcs_info:hg:*' formats ' (%s)-[%12.12i %b]-'
-### Truncate long hash to 12-chars but also allow for multiple parents
+### hg: Truncate long hash to 12-chars but also allow for multiple parents
# Hashes are joined with a + to mirror the output of `hg id`.
zstyle ':vcs_info:hg+set-hgrev-format:*' hooks hg-shorthash
function +vi-hg-shorthash() {
@@ -153,7 +155,7 @@ function +vi-hg-shorthash() {
ret=1
}
-### Show marker when the working directory is not on a branch head
+### hg: Show marker when the working directory is not on a branch head
# This may indicate that running `hg up` will do something
# NOTE: the branchheads.cache file is not updated with every Mercurial
# operation, so it will sometimes give false positives. Think of this more as a
--
1.7.1.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author