From d1f282bbabda1cdf14c52c5d80f5dd032587307f Mon Sep 17 00:00:00 2001 From: Marlon Richert Date: Tue, 2 May 2023 21:29:41 +0300 Subject: [PATCH] Add setting for `compinit` arguments --- README.md | 5 +++++ functions/..znap.compinit-hook | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1af7f3e..08c62a4 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,11 @@ Note that the above example does not include any call to `bashcompinit`](http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Initialization) in the `.zshrc` file. That is because Znap will run these for you as needed. +If necessary, you can let Znap pass arguments to `compinit` as follows: +```sh +zstyle '*:compinit' arguments -D -i -u -C -w +``` + ### Asynchronous compilation Znap compiles your scripts and functions in the background. This way, your shell will start up even faster next time! diff --git a/functions/..znap.compinit-hook b/functions/..znap.compinit-hook index aa6acac..acc34e2 100644 --- a/functions/..znap.compinit-hook +++ b/functions/..znap.compinit-hook @@ -10,7 +10,9 @@ if ! [[ -v _comp_setup && -f $_comp_dumpfile ]]; then autoload -Uz compinit bindkey() {:} { - compinit -d $_comp_dumpfile + local -a compargs=() + zstyle -a ':autocomplete::compinit' arguments compargs + compinit -d "$_comp_dumpfile" "$compargs[@]" } always { unfunction bindkey }