all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* guix completion in zsh
@ 2020-05-24 11:35 Reza Alizadeh Majd
  2020-05-26 21:14 ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Reza Alizadeh Majd @ 2020-05-24 11:35 UTC (permalink / raw)
  To: help-guix mailing list

Hi, 

after replacing the default shell with `zsh`, I lost the tab completion
feature for Guix commands. do I need to perform any specific configuration
to enable this feature?

--
Reza Alizadeh Majd
PantherX Team
https://pantherx.org


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: guix completion in zsh
  2020-05-24 11:35 guix completion in zsh Reza Alizadeh Majd
@ 2020-05-26 21:14 ` Ludovic Courtès
  2020-05-30  6:21   ` Reza Alizadeh Majd
  0 siblings, 1 reply; 5+ messages in thread
From: Ludovic Courtès @ 2020-05-26 21:14 UTC (permalink / raw)
  To: Reza Alizadeh Majd; +Cc: help-guix mailing list

Hi,

"Reza Alizadeh Majd" <r.majd@pantherx.org> skribis:

> after replacing the default shell with `zsh`, I lost the tab completion
> feature for Guix commands. do I need to perform any specific configuration
> to enable this feature?

I think you need to make sure the Zsh completion file for Guix is
sourced.

Normally that happens by default on Guix System, but maybe something
broke?  (I don’t use Zsh.)

HTH,
Ludo’.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: guix completion in zsh
  2020-05-26 21:14 ` Ludovic Courtès
@ 2020-05-30  6:21   ` Reza Alizadeh Majd
  2020-06-01 16:10     ` Dmitry Alexandrov
  2020-06-02 13:59     ` Brice Waegeneire
  0 siblings, 2 replies; 5+ messages in thread
From: Reza Alizadeh Majd @ 2020-05-30  6:21 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: help-guix mailing list

On Tue, 26 May 2020 23:14:01 +0200
Ludovic Courtès <ludo@gnu.org> 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?


-- 
Reza Alizadeh Majd
PantherX Team
https://www.pantherx.org/


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: guix completion in zsh
  2020-05-30  6:21   ` Reza Alizadeh Majd
@ 2020-06-01 16:10     ` Dmitry Alexandrov
  2020-06-02 13:59     ` Brice Waegeneire
  1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Alexandrov @ 2020-06-01 16:10 UTC (permalink / raw)
  To: Reza Alizadeh Majd; +Cc: help-guix mailing list

[-- Attachment #1: Type: text/plain, Size: 476 bytes --]

Reza Alizadeh Majd <r.majd@pantherx.org> wrote:
> Ludovic Courtès <ludo@gnu.org> 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?

No completion helpers for Guix belong to Guix (logically enough?).  I do not use zsh, but ‘share/zsh/site-functions’ looks like what you are seeking.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: guix completion in zsh
  2020-05-30  6:21   ` Reza Alizadeh Majd
  2020-06-01 16:10     ` Dmitry Alexandrov
@ 2020-06-02 13:59     ` Brice Waegeneire
  1 sibling, 0 replies; 5+ messages in thread
From: Brice Waegeneire @ 2020-06-02 13:59 UTC (permalink / raw)
  To: Reza Alizadeh Majd; +Cc: Help-Guix, help-guix mailing list

Hello Reza,

On 2020-05-30 06:21, Reza Alizadeh Majd wrote:
> On Tue, 26 May 2020 23:14:01 +0200
> Ludovic Courtès <ludo@gnu.org> 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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-02 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-24 11:35 guix completion in zsh Reza Alizadeh Majd
2020-05-26 21:14 ` Ludovic Courtès
2020-05-30  6:21   ` Reza Alizadeh Majd
2020-06-01 16:10     ` Dmitry Alexandrov
2020-06-02 13:59     ` Brice Waegeneire

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.