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 Feb 13,  7:12pm, Yuri D'Elia wrote:
}
} Even after reading the _all_matches example, I'm not sure I follow you
} about using comppostfuncs. It would still be called too late for my
} purposes.

Indeed, I forgot how early in the process _setup gets called, and that
is the only place the list-colors style is examined.

At the end of _complete, the color styles will all have been loaded
into the array $_comp_colors, and $compstate will have the values you
need.  So I think your best bet is to create a wrapper function that
calls _complete and then updates the $_comp_colors array, and finally
returns whatever the exit status _complete was.

To populate $_comp_colors you need to have SOME relevant list-colors
style set.  Perhaps the examples you gave except without the -e flag.

If you do that and you also have the recommended

    zstyle ':completion:*' group-name ''
    
style set, then each element of $_comp_colors will look like e.g.

    (argument-rest)hl-first-diff
or
    (all-files)hl-first-diff-path

where "(tag)" is missing for the defaults.  You'll need to walk over
the array, call each function, and substitute its $reply value into
the corresponding element.

_color_complete() {
  _complete
  local ret=$?
  # ... fix up $_comp_colors ...
  return ret
}

Or some similar creative hack of your own ...



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