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

Re: widget special PREFIX variable and cursor position with complete_in_word



On 02/14/2014 10:36 PM, Oliver Kiddle wrote:
> That's odd. Perhaps something in your setup conflicts with it. It'd be
> interesting to know what.

Ah yes, I was missing zsh/complist (setting the list-colors style was loading it automatically perhaps?)

I've refined a bit the _show_ambiguity_end function with what I already had:

_show_ambiguity_end()
{
  local prefix=${${compstate[unambiguous]}[1,${compstate[unambiguous_cursor]}-1]:Q}
  if [ -n $prefix ]
  then
    [ "$curtag" = "all-files" ] && prefix=${prefix##*/} 
    ZLS_COLORS+=":=(#b)${prefix:q}(?|)*==4"
  fi
}

By also unquoting and checking for the 'all-files' tag, I can correctly match completions for (path)/files and quoted arguments.

I don't think the complex recursive match is needed at all.
I couldn't find any case that would require that. Do you have an example?

By stripping the directory, It now also works correctly for ambiguous matches such as:

$ ls //x

as I initially wanted.

Ahhh, lovely!!




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