zsh-users
 help / color / mirror / code / Atom feed
* In menu-select, how to make accept-line do not put a space
@ 2019-07-10 15:52 Sebastian Gniazdowski
  2019-07-10 16:30 ` Mikael Magnusson
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-10 15:52 UTC (permalink / raw)
  To: Zsh Users

Hello,I'm using the following setup:

zstyle ':completion:*:*:*:default' menu yes select search
function double-accept { accept-line; accept-line; }
zle -N double-accept
bindkey -M menuselect ' ' double-accept

It works fine, but it puts a space after pressing the space to accept
an entry. I would like it to not do it. How to accomplish this?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

* Re: In menu-select, how to make accept-line do not put a space
  2019-07-10 15:52 In menu-select, how to make accept-line do not put a space Sebastian Gniazdowski
@ 2019-07-10 16:30 ` Mikael Magnusson
  2019-07-10 18:43   ` Sebastian Gniazdowski
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Magnusson @ 2019-07-10 16:30 UTC (permalink / raw)
  To: Sebastian Gniazdowski; +Cc: Zsh Users

On 7/10/19, Sebastian Gniazdowski <sgniazdowski@gmail.com> wrote:
> Hello,I'm using the following setup:
>
> zstyle ':completion:*:*:*:default' menu yes select search
> function double-accept { accept-line; accept-line; }
> zle -N double-accept
> bindkey -M menuselect ' ' double-accept
>
> It works fine, but it puts a space after pressing the space to accept
> an entry. I would like it to not do it. How to accomplish this?

This doesn't do what you think it does.

"Note  that  the  following always perform the same task within the
menu selection map and cannot be replaced by user defined widgets, nor
can the set of functions be extended"
..list of widgets..
"any other zle function  not  listed leaves menu selection and
executes that function.  It is possible to make widgets in the above
list do the same by using the form of the widget with a `.' in front.
For example,  the  widget  `.accept-line'  has  the effect of leaving
menu selection and accepting the entire command line."

-- 
Mikael Magnusson

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

* Re: In menu-select, how to make accept-line do not put a space
  2019-07-10 16:30 ` Mikael Magnusson
@ 2019-07-10 18:43   ` Sebastian Gniazdowski
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Gniazdowski @ 2019-07-10 18:43 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Zsh Users

On Wed, 10 Jul 2019 at 18:30, Mikael Magnusson <mikachu@gmail.com> wrote:
> This doesn't do what you think it does.
> ...
> "any other zle function  not  listed leaves menu selection and
> executes that function.

I'm trying to solve this with a function that deploys a code to be
evaluated in zle context (the zle-F boomerang trick):

https://gist.github.com/psprint/f2a0db07cc80351e19e30378c6eaa779

function double-accept { echo 1 >> /tmp/reply; deploy-code "BUFFER[-1]=''";  }
zle -N double-accept
bindkey -M menuselect ' ' double-accept

However, I don't even get the message in /tmp/reply. Anyone knows why?

-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org

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

end of thread, other threads:[~2019-07-10 18:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 15:52 In menu-select, how to make accept-line do not put a space Sebastian Gniazdowski
2019-07-10 16:30 ` Mikael Magnusson
2019-07-10 18:43   ` Sebastian Gniazdowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).