zsh-users
 help / Atom feed
* space after completion
@ 2018-09-28 12:16 Pier Paolo Grassi
  2018-09-28 12:51 ` Pier Paolo Grassi
  0 siblings, 1 reply; 2+ messages in thread
From: Pier Paolo Grassi @ 2018-09-28 12:16 UTC (permalink / raw)
  To: Zsh-Users List

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

Hello, I have noticed that when I define a completion function, which does
something like:

_arguments -s -S -A '-*' \
"*:commands:->commands"

case $state in
(commands)
compadd -S '' -V commands -a -Q -U commands_array
  ;;
esac


(actual code stripped down a bit)
the array commands_array is populated by some code with the "commands" I
want to have completed.
All works well, but when I choose a command the cursor stops right after
the completion, instead of adding a space like _gnu_generic does when I
complete the options.
This way if I press tab again without inserting a space, the command I
choose gets substituted with the first command from the completion menu and
the menu is presented again.

What would be a good way of achieving the same thing as _gnu_generic? is
there some completion style that can be leveraged here?

thanks in advance

-- 
Pier Paolo Grassi
email: pierpaolog@gmail.com
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO

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

* Re: space after completion
  2018-09-28 12:16 space after completion Pier Paolo Grassi
@ 2018-09-28 12:51 ` Pier Paolo Grassi
  0 siblings, 0 replies; 2+ messages in thread
From: Pier Paolo Grassi @ 2018-09-28 12:51 UTC (permalink / raw)
  To: Zsh-Users List

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

hello again, I solved it: it was the  -S '' in
compadd -S ''

that was causing the trouble, I removed it and now it adds the space after
the completion by itself
best

Il giorno ven 28 set 2018 alle ore 14:16 Pier Paolo Grassi <
pierpaolog@gmail.com> ha scritto:

> Hello, I have noticed that when I define a completion function, which does
> something like:
>
> _arguments -s -S -A '-*' \
> "*:commands:->commands"
>
> case $state in
> (commands)
> compadd -S '' -V commands -a -Q -U commands_array
>   ;;
> esac
>
>
> (actual code stripped down a bit)
> the array commands_array is populated by some code with the "commands" I
> want to have completed.
> All works well, but when I choose a command the cursor stops right after
> the completion, instead of adding a space like _gnu_generic does when I
> complete the options.
> This way if I press tab again without inserting a space, the command I
> choose gets substituted with the first command from the completion menu and
> the menu is presented again.
>
> What would be a good way of achieving the same thing as _gnu_generic? is
> there some completion style that can be leveraged here?
>
> thanks in advance
>
> --
> Pier Paolo Grassi
> email: pierpaolog@gmail.com
> linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
> founder: https://www.meetup.com/it-IT/Machine-Learning-TO
>


-- 
Pier Paolo Grassi
email: pierpaolog@gmail.com
linkedin: https://www.linkedin.com/in/pier-paolo-grassi-19300217
founder: https://www.meetup.com/it-IT/Machine-Learning-TO

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-28 12:16 space after completion Pier Paolo Grassi
2018-09-28 12:51 ` Pier Paolo Grassi

zsh-users

Archives are clonable: git clone --mirror http://inbox.vuxu.org/zsh-users

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.zsh.users


AGPL code for this site: git clone https://public-inbox.org/ public-inbox