Add a style in order to amend compinit's command line
authorFrank Terbeck <ft@grml.org>
Sat, 18 Aug 2018 15:10:54 +0000 (17:10 +0200)
committerFrank Terbeck <ft@grml.org>
Sat, 18 Aug 2018 19:57:01 +0000 (21:57 +0200)
Includes documentation with a possible usage example.

Closes: Github bugreport #103

doc/grmlzshrc.t2t
etc/zsh/zshrc

index 844cb71..46b0170 100644 (file)
@@ -131,6 +131,38 @@ obtained with the zprof builtin command (see zshmodules(1) for details).
 Specifies the location of the completion dump file. Default: $HOME/.zcompdump.
 
 
+= GRML-ZSHRC SPECIFIC STYLES =
+
+Styles are a context sensitive configuration mechanism included with zsh. The
+shell uses it extensively in sub-systems like the completion and the VCS info
+system. It lives outside of the classic shell variable namespace, so it avoids
+polluting it. New functionality in grml's zshrc will likely use styles instead
+of variables. Some features of the setup (like the directory stack handling)
+already use styles. Those styles are documented with the specific features.
+This section documents more general styles.
+
+== Context: :grml:completion:compinit ==
+This context revolves around the zshrc's //compinit// function call, that
+initialises zsh's function based completion system.
+
+: **arguments**
+This style allows the injection of arguments to the command line that is used
+to run compinit. It is a list style and its default is the empty list. Using
+this style, it's possible to add **-i** to //compinit// in order to disable
+//compaudit//.
+\
+```
+zstyle ':grml:completion:compinit' arguments -i
+```
+\
+Only do this, if you know what sort of security checks are disabled if
+//compaudit// is not active and if that's acceptable with your specific setup.
+\
+This style has to be set at the point that Grml's zshrc runs //compinit//. A
+possible way to achieve this is to set it in //~/.zshrc.pre// (see AUXILIARY
+FILES below for details).
+
+
 = FEATURE DESCRIPTION =
 This is an in depth description of non-standard features implemented by
 //grmlzshrc//.
index 35a6446..04422c0 100644 (file)
@@ -670,7 +670,10 @@ fi
 # completion system
 COMPDUMPFILE=${COMPDUMPFILE:-${ZDOTDIR:-${HOME}}/.zcompdump}
 if zrcautoload compinit ; then
-    compinit -d ${COMPDUMPFILE} || print 'Notice: no compinit available :('
+    typeset -a tmp
+    zstyle -a ':grml:completion:compinit' arguments tmp
+    compinit -d ${COMPDUMPFILE} "${tmp[@]}" || print 'Notice: no compinit available :('
+    unset tmp
 else
     print 'Notice: no compinit available :('
     function compdef { }