Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Using menu completion after predict



On Monday 30 April 2018 17:26,
Dave Woodfall <dave@xxxxxxxxxxxxxx> 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



Messages sorted by: Reverse Date, Date, Thread, Author