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

Re: Asynchronous completions?



On 6/5/19, Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx> wrote:
> Hello,
> I've just waited a bit after: git checkout <TAB>. The delay was caused
> by the completion script loading all revisions, while I only wanted
> branches.
>
> This gave me an idea – to use exec {FD}< <(...) and zle -F to update
> the completion, after first displaying "Loading all revisions". In one
> project I'm passing as much as 13000 lines through the {FD} after each
> keypress without any problems.
...
> I'm not familiar with coding completions. Could someone else start the
> async-completions trend?

async-completions doesn't make any sense, you can't do anything else
while completing and you can already abort it by pressing ctrl-c. If
you want to show a message first, you can already do so, it will be
overwritten by the completion list once that's finished building. For
example I wrap the complete-word etc widgets with a function that
changes the cursor color, and then changes it back after, but you
could display a message instead if you want.

function _generic_cursorcol() {
  #zle -R completing...
  cursorcol cyan
  { _generic "$@" } always {
    cursorcol_normal
  }
}
() for 1 {
  zle -C $1 $1 _generic_cursorcol
} complete-word reverse-menu-complete complete-word menu-complete
menu-expand-or-complete



-- 
Mikael Magnusson



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