From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9799 invoked by alias); 29 Oct 2013 17:52:14 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 18071 Received: (qmail 23909 invoked from network); 29 Oct 2013 17:52:09 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=lK8u7I6mdX2cciWD95sH5BgOKsDLyBXyTFhYVuPCopw=; b=plI+0WmQAdvEeAK8VvguzEqKIlnaFbYGiAWC7mS4T5c+DPFHYGeWqqFzPoQTi3YecH vZtIZ+9Imiuo18jlSkVs020htBEBcOwpg3mzH/OxoitviiJ8kLc0otAqkdd8tpgJMBAj JhVVyZrBtgkmGyvjkSb4vnfxqgdl5/TVGA+XtYElv4UJApUu+jm5YaxxkKzGBPb3t+Vu Wui9+AKdrHdVValOzhAsJUnkxtY0egNbnNNb6cm0BS4Qe4OQb9dLUhsWRGy+icttiixR kqtz0t6MzpaSNLl/QOyvNVJfouxSebwajmYinIE+ZPB8SMA4ZWd0c+hjT4iNU5jtsdRT gYjQ== MIME-Version: 1.0 X-Received: by 10.112.143.166 with SMTP id sf6mr772947lbb.29.1383069123321; Tue, 29 Oct 2013 10:52:03 -0700 (PDT) Date: Tue, 29 Oct 2013 15:52:03 -0200 Message-ID: Subject: Fish-like autosuggestions From: Thiago Padilha To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=089e012296f4cba30e04e9e4df7b --089e012296f4cba30e04e9e4df7b Content-Type: text/plain; charset=UTF-8 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 --089e012296f4cba30e04e9e4df7b--