zshrc: Improve dir based profiles documentation
authorFrank Terbeck <ft@bewatermyfriend.org>
Sat, 30 May 2009 17:25:39 +0000 (19:25 +0200)
committerFrank Terbeck <ft@bewatermyfriend.org>
Sat, 30 May 2009 17:25:39 +0000 (19:25 +0200)
Clarify how the context of the styles for directory based profiles are
used used and mention a "best practice".

debian/changelog
etc/zsh/zshrc

index 818fbf0..ade7055 100644 (file)
@@ -1,3 +1,10 @@
+grml-etc-core (0.3.72) unstable; urgency=low
+
+  * zshrc: Clarify how the context of the styles for directory based
+    profiles are used and mention a "best practice".
+
+ -- Frank Terbeck <ft@grml.org>  Sat, 30 May 2009 19:20:12 +0200
+
 grml-etc-core (0.3.71) unstable; urgency=low
 
   * zshrc: Add directory based profiles
index c12227e..e999478 100644 (file)
@@ -1052,10 +1052,20 @@ function chpwd_profiles() {
     # in the third part of the context, a function called chpwd_profile_grml,
     # for example, is called (if it exists).
     #
-    # If no pattern patches (read: no profile is detected) the profile is
+    # If no pattern matches (read: no profile is detected) the profile is
     # set to 'default', which means chpwd_profile_default is attempted to
     # be called.
     #
+    # A word about the context (the ':chpwd:profiles:*' stuff in the zstyle
+    # command) which is used: The third part in the context is matched against
+    # ${PWD}. That's why using a pattern such as /foo/bar(|/|/*) makes sense.
+    # Because that way the profile is detected for all these values of ${PWD}:
+    #   /foo/bar
+    #   /foo/bar/
+    #   /foo/bar/baz
+    # So, if you want to make double damn sure a profile works in /foo/bar
+    # and everywhere deeper in that tree, just use (|/|/*) and be happy.
+    #
     # The name of the detected profile will be available in a variable called
     # 'profile' in your functions. You don't need to do anything, it'll just
     # be there.