From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 2MnPC/Jt1l5/VwAA0tVLHw (envelope-from ) for ; Tue, 02 Jun 2020 15:19:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EAWsB/Jt1l5nJgAA1q6Kng (envelope-from ) for ; Tue, 02 Jun 2020 15:19:14 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id AD4DC940CBD for ; Tue, 2 Jun 2020 15:19:13 +0000 (UTC) Received: from localhost ([::1]:52260 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jg8h6-0003hc-Nr for larch@yhetil.org; Tue, 02 Jun 2020 11:19:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35470) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg7Rc-0000Ea-SJ; Tue, 02 Jun 2020 09:59:08 -0400 Received: from relay4-d.mail.gandi.net ([217.70.183.196]:48797) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jg7Rb-0001Ju-E6; Tue, 02 Jun 2020 09:59:08 -0400 Received: from webmail.gandi.net (webmail18.sd4.0x35.net [10.200.201.18]) (Authenticated sender: brice@waegenei.re) by relay4-d.mail.gandi.net (Postfix) with ESMTPA id 4EB90E000D; Tue, 2 Jun 2020 13:59:01 +0000 (UTC) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Tue, 02 Jun 2020 13:59:01 +0000 From: Brice Waegeneire To: Reza Alizadeh Majd Subject: Re: guix completion in zsh In-Reply-To: <20200530105121.46c1ae3d@pantherarch.localdomain> References: <87d06qo0va.fsf@gnu.org> <20200530105121.46c1ae3d@pantherarch.localdomain> Message-ID: <140372893f70a6ef57ddf513a4ee05a0@waegenei.re> X-Sender: brice@waegenei.re User-Agent: Roundcube Webmail/1.3.8 Received-SPF: pass client-ip=217.70.183.196; envelope-from=brice@waegenei.re; helo=relay4-d.mail.gandi.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/02 09:15:20 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Tue, 02 Jun 2020 11:17:59 -0400 X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Help-Guix , help-guix mailing list Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: "Help-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of help-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=help-guix-bounces@gnu.org X-Spam-Score: -1.01 X-TUID: CLFuoa8dHNc5 Hello Reza, On 2020-05-30 06:21, Reza Alizadeh Majd wrote: > On Tue, 26 May 2020 23:14:01 +0200 > Ludovic Courtès wrote: > >> I think you need to make sure the Zsh completion file for Guix is >> sourced. >> > > Thanks for you response, what is the right location to find this "Zsh > completion file"? is it installed during installation of `zsh` package? I had the same issue since I switched to Guix but I didn't took the time to look into it before. I just submitted a patch[0] that add "/run/current-system/profile/share/zsh/site-functions" to $fpath, so system packages will get completions. To get completions from user profile, I added the following to my system configuration: --8<---------------cut here---------------start------------->8--- (define %zshrc (plain-file "zshrc" "\ fpath+=($HOME/.guix-profile/share/zsh/site-functions) ")) (operating-system … (services (list … (simple-service 'zshrc etc-service-type (list `("zshrc" ,%zshrc)))))) --8<---------------cut here---------------end--------------->8--- When $fpath is properly set, the user only have to run “autoload -Uz compinit && compinit” or add it to it's '~/.zshrc' to enable completions. I don't know how to add completions when using “guix environment” especially when executed multiple times in a shell since GUIX_ENVIRONMENT get replaced each time it's executed. Also note that the ZSH completion for 'guix' has never been updated in 4 years so it's missing quite a few commands and options while 'guix-daemon' completion doesn't exists. So you get completions as nice as the ones from bash. I tried updating zsh's completions but I didn't went far because it's tedious since it's a lot of copy pasting from “guix --help”. So to get proper completion support for zsh a better solution would be to use the bash completions as they are parsed from “guix --help” directly instead of being copy-pasted and that zsh provide a bash compatible completion system trough 'bashcompinit'. But unfortunately our bash completions have some bashism that zsh can't understand, especially the 'compopt' built-in. You can try to use bash completion in zsh by running “autoload bashcompinit && bashcompinit && source ./etc/completion/bash/guix” but you will end up with half broken completions. [0]: https://issues.guix.info/issue/41662 - Brice