zsh-users
 help / color / mirror / code / Atom feed
From: Thiago Padilha <tpadilha84@gmail.com>
To: zsh-users@zsh.org
Subject: Fish-like autosuggestions
Date: Tue, 29 Oct 2013 15:52:03 -0200	[thread overview]
Message-ID: <CAAq2XdpaRKOnDe1LBafsq+Ln6wU0_9RL71exrOEyboi1PWcx3w@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]

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

             reply	other threads:[~2013-10-29 17:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 17:52 Thiago Padilha [this message]
2013-10-30 16:25 ` Bart Schaefer
2013-11-04 19:30   ` Thiago Padilha
2013-11-05 15:57     ` Bart Schaefer
2013-11-05 16:18       ` Peter Stephenson
2013-11-05 19:46         ` Bart Schaefer
2013-11-05 20:40           ` Bart Schaefer
2013-11-06 20:07             ` Peter Stephenson
2013-11-07  0:04               ` Bart Schaefer
2013-11-07  9:44                 ` Peter Stephenson
2013-11-07 18:07                   ` Thiago Padilha
2013-11-07 18:12                     ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAq2XdpaRKOnDe1LBafsq+Ln6wU0_9RL71exrOEyboi1PWcx3w@mail.gmail.com \
    --to=tpadilha84@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).