zshrc: Improve dir based profiles documentation
[grml-etc-core.git] / etc / zsh / zshrc
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.