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

Fish-like autosuggestions



Hi

I've just finished implementing a zle widget that provides fish-like
fast/unobtrusive autosuggestions.

Like the 'predict-on' widget, this one uses suggestions from from history
then from the user completion functions. There are a couple of differences
though:

- Only the part left of the cursor is considered(the rest is 'grayed-out'
to give a visual hint). The suggested part must be accepted explicitly
- For suggesting with user completion functions, a suggestion daemon(shared
by all shells for an user) is used. The suggestion is updated
asynchronously with zle -F so the shell will be responsive even with slow
completion functions.
- The widget is 'paused' when doing certain actions that could lead to
editing the middle of the line(eg entering vi mode or moving the cursor to
the left)

I'm sure there are many improvements to be made as I am not a zsh expert.
One thing I couldnt figure out is how to handle ctrl+c correctly: since
recursive-edit is used ctrl+c has to be pressed two times to exit zle

I'm also sure there are many bugs, but right now the widget should be
usable enough, so feel free to try and give feedback :)

For anyone interested, here it is:
https://github.com/tarruda/zsh-autosuggestions (I recommend trying, this
will likely improve efficiency in using zsh history)

The daemon uses valodim's code to extract completions programmatically:
https://github.com/Valodim/zsh-capture-completion , so big thanks to him


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