zsh-workers
 help / color / mirror / code / Atom feed
* Using menu completion after predict
@ 2018-04-30 16:26 David Woodfall
  2018-04-30 19:54 ` David Woodfall
  0 siblings, 1 reply; 2+ messages in thread
From: David Woodfall @ 2018-04-30 16:26 UTC (permalink / raw)
  To: Zsh Workers

Hi

I've been experimenting with the predict completer and it works well.
There is something that I haven't been able to figure out yet though.

When using, say, cdr with menu complete, when I first type 'cdr '
predict brings up the last match in history. Let's say:

crd 4

I press tab for menu complete to activate but the '4' stays on the
command line, which means that after selecting an entry from the
list I now have two numbers, say:

cdr 4 1

Of course cdr will give an error if I try to execute the command.

Is there a way of clearing the prompt line when certain menu
completions activate, like cdr, so that this doesn't occur?

I know I can use a bind to kill to eol, but I'd rather have some
filter or completion option for ':completion:*:*:cdr:*:*' that would
clear to the end of the line before entering the selection menu.

These are my current settings:

zstyle ':completion:*' menu select yes=long-list select=long-list
zstyle ':completion:*' completer _complete _match _approximate \
				_correct  _expand _prefix
zstyle ':completion::prefix:*' completer _complete
zstyle ':completion:*:*:cdr:*:*' menu selection
zstyle ':completion:*:*:cdr:*:*' completer _complete
zstyle ':completion:predict:*' completer _history
zstyle ':predict' menu select no
zstyle ':predict' toggle true
zstyle ':predict' verbose true
zstyle ':predict' cursor complete

Any help is greatly appreciated.

-Dave


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

* Re: Using menu completion after predict
  2018-04-30 16:26 Using menu completion after predict David Woodfall
@ 2018-04-30 19:54 ` David Woodfall
  0 siblings, 0 replies; 2+ messages in thread
From: David Woodfall @ 2018-04-30 19:54 UTC (permalink / raw)
  To: zsh-workers

On Monday 30 April 2018 17:26,
Dave Woodfall <dave@dawoodfall.net> put forth the proposition:
>Hi
>
>I've been experimenting with the predict completer and it works well.
>There is something that I haven't been able to figure out yet though.
>
>When using, say, cdr with menu complete, when I first type 'cdr '
>predict brings up the last match in history. Let's say:
>
>crd 4
>
>I press tab for menu complete to activate but the '4' stays on the
>command line, which means that after selecting an entry from the
>list I now have two numbers, say:
>
>cdr 4 1
>
>Of course cdr will give an error if I try to execute the command.
>
>Is there a way of clearing the prompt line when certain menu
>completions activate, like cdr, so that this doesn't occur?
>
>I know I can use a bind to kill to eol, but I'd rather have some
>filter or completion option for ':completion:*:*:cdr:*:*' that would
>clear to the end of the line before entering the selection menu.
>
>These are my current settings:
>
>zstyle ':completion:*' menu select yes=long-list select=long-list
>zstyle ':completion:*' completer _complete _match _approximate \
>				_correct  _expand _prefix
>zstyle ':completion::prefix:*' completer _complete
>zstyle ':completion:*:*:cdr:*:*' menu selection
>zstyle ':completion:*:*:cdr:*:*' completer _complete
>zstyle ':completion:predict:*' completer _history
>zstyle ':predict' menu select no
>zstyle ':predict' toggle true
>zstyle ':predict' verbose true
>zstyle ':predict' cursor complete
>
>Any help is greatly appreciated.
>
>-Dave
>

Well I've made a workaround that is OK so far.

_vi_tab() {
  if [ "$KEYMAP" = "vicmd" ]; then
    zle vi-add-eol
    zle vi-insert
  else
    zle vi-kill-eol
    zle menu-expand-or-complete
  fi
}

Probably not the proper solution, but it saves deleting the command line
manually.

-Dave


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

end of thread, other threads:[~2018-04-30 19:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-30 16:26 Using menu completion after predict David Woodfall
2018-04-30 19:54 ` David Woodfall

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).