From c5294caa2cc6222dc045183ff66c4c024d246c3e Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Mon, 8 Jul 2024 15:18:39 +0700 Subject: [PATCH] zsh: consolidate completion initialization --- home/programs/zsh.nix | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/home/programs/zsh.nix b/home/programs/zsh.nix index 05ecd01..855dec7 100644 --- a/home/programs/zsh.nix +++ b/home/programs/zsh.nix @@ -51,10 +51,27 @@ in save = 40000; size = 40000; }; + completionInit = lib.mkOrder 9999 (concatStrings [ + /* bash */ + '' + mkdir -p $ZSH_CACHE_DIR/completions + fpath+=$ZSH_CACHE_DIR/completions + fpath+=${pkgs.zsh-completions}/share/zsh/site-functions + '' + (optionalString config.profile.podman.enable /*bash*/ '' + if [ ! -f $ZSH_CACHE_DIR/completions/_podman ]; then + podman completion zsh > $ZSH_CACHE_DIR/completions/_podman + fi + '') + # Value below must be always last in the completionInit + /* bash */ + '' + autoload -U compinit && compinit + '' + ]); syntaxHighlighting.enable = true; initExtraFirst = /*bash*/ '' export ZSH_CACHE_DIR=$HOME/.cache/zsh - fpath+=${pkgs.zsh-completions}/share/zsh/site-functions if [ -f $HOME/.config/zsh/.p10k.zsh ]; then source $HOME/.config/zsh/.p10k.zsh