From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 11273 invoked from network); 26 Jul 2021 14:15:04 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Jul 2021 14:15:04 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1627308904; b=T9KlOoXk+24X8DWsFu52s0ixdNeIci+RIDF1Rwh9bh3IuVe7+lAvbp6HEx2PCJ4hMxdwW5nPjJ 80W1pCITk4ZH3TrxqSuibUmSeVkB22elcbx7lHhBq7EM/xMA3dDy6CzW0phJPMyBxpWoyUWvn3 WwA9wwV7gi+cy9FAyH+2AUHXnizrGjhKzlGthhKKdY5bwh/TI+NIDxaQhspxlmTp7h0RFudJIN G1n5LhUL35fNPQapjYxrLfs0osbKCXJmxoRVyYb4ECbForeOLi3W+eiSb54HaRdRVkqrIiC9DN mvxEfJMGaRVgAZCQWoBoPjddim+2Dvdy8McikbqWiwX6Lw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ed1-f50.google.com) smtp.remote-ip=209.85.208.50; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1627308904; bh=euZDu2KLbXpO3WTQYBjzFgZAvfud9EH3wnHyaYFFn9s=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=JmAjRZMrlTAwstKt6yM+3EHnzML+8dt326MxADa+QqJki5+ry8iX+R0g2nZ2y1PwFOx+YjyXd5 uBx6+HrMn7F43VeD8JkAACTumZpRAd1QPCQhsB8CxeOxLKsJ/qFAhyFt6uUnOl3b7EsXue9IJs /22J2NkLhhfBzlM15RqYFySwfV+kcxVHttAM7s/r7mik66LyfqVtouhasn8YlK29hZrzo0SIkJ tXLLiYV07pJBJd1ehjUu5ZBsvnQ0NR25r1jWFf4E6QVBD5Q+wTkbPwxF5cOOqVUxyfhBz99h7s cqnyjsJ2ontgX6krGe+aXKJ4hLJ6JePKL6fNwk94EWWpvQ==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=tll581/7g+6nVCh/e8DCsJuK6Q7iMQoywG73udqr/pE=; b=UodsfHaDtpFKHIQrcX4UHUV7Lv nOQR5pVE00yO7DA5qo7DB0VmYOs7hJAhp0pmI3gIjPhMD58mSOW/oLLBuOpz/yKCBW6fPF1SxHXTO UsbcC635zNi+eMEad3vo0pLLxuWHEm1eibb0yBtyl4QtdYxTUaFd2XIk9ntALH3rhRmFCAfGnh0PM u/Rs5tNQ9OMbMymR6C1Fk6Od9KoLP1Fuvdr7VtKHmaNxO1Jie/h8OOzG+9GgeOmNZLPh6lQwGMGju Kt3sbdKuFmtQkQzny2tiyPV57I7bA7ZwvKJE2UP8JZu1+R/XRoBEzGXWjOn/FFXnGzaw0W1hvEk6B NzoqypdA==; Received: from authenticated user by zero.zsh.org with local id 1m81Nm-000MSg-Os; Mon, 26 Jul 2021 14:15:02 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ed1-f50.google.com) smtp.remote-ip=209.85.208.50; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ed1-f50.google.com ([209.85.208.50]:35468) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1m81Mv-000Lga-VW; Mon, 26 Jul 2021 14:14:11 +0000 Received: by mail-ed1-f50.google.com with SMTP id u12so10790021eds.2 for ; Mon, 26 Jul 2021 07:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=tll581/7g+6nVCh/e8DCsJuK6Q7iMQoywG73udqr/pE=; b=igB/cNW4WuKPJyRCnApW5sjAh1bLVhKOHo5Jfc/OLoRq8JnxewovKhNCRLil2CLGf6 6uk2PySjMaQ6/BHP/y+c44wuph05halySKgNJg6frgxCi5U3+hnA0JBEwjsbFNsI6S3w DpApSIOT5+As8VGdIqMpQJTlFJtml6/dAXbILSQ9or+fecmhAphjNfTjd2L0cgDnUmZR WAk1ERXEW7yyVzXxvfmEktPpZNGlfpEkqulEUDId6cfgAKf6/6hf9VQEARUGuu3eQ9c1 RRkoLMAYhCNpbb4YlP5VmpAfxfzdMMS+HLmvZpADTJH1sAKMYz6Z47nH/0SWHfgniaeb Zxiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=tll581/7g+6nVCh/e8DCsJuK6Q7iMQoywG73udqr/pE=; b=brY6x3ArTBsoNVA1WNcy6FSO9fhqbvjvEV9px84WJ99RmRct7sG58XNKui1kj8kJP3 VYzJ/FC/WTvauIfjnn6x0P+UBL0f4Cs9FuWfhAaVRb4u4EwqmG9bIflj222AGf4GXvVl 0ui2TW9HuN/1PJqSGGjzc/Gscd0mJS3bRnynj3Uf9mUGdyAXvZT2qgnnyhapr63fu0iT NiTv+I5JDdShNbSIfAopbMIFD0IjSZ9I/fWPYP/a2zWxEi7k7RyysqZABLnMQOOKorfI KVhYDtExouou/hbz3fcDhGrqbynQKKnYYAmSBu7iahe757RALq0UwPzVFZ7jLvNJ21a2 o2MA== X-Gm-Message-State: AOAM5317blkchHLtWJa5AbHg+C9aSLnDRZPOMZnw5d3KoIcyQ2M8QJsZ WEnLbgNl6KhQSega5TsOl8uix1ux/9qaziC/3BsXfZlQSX4= X-Google-Smtp-Source: ABdhPJyNIWc3Xtd+QRWZUg1l+56FGEHzQzKMUxeu7EOwyiyluXzh6B/UYCskWyIcFM+At8a+cm0unKrEoKkCtl0PCAg= X-Received: by 2002:a50:ee15:: with SMTP id g21mr21313877eds.334.1627308849415; Mon, 26 Jul 2021 07:14:09 -0700 (PDT) MIME-Version: 1.0 From: =?UTF-8?B?UGV0ZXIgU2zDrcW+aWs=?= Date: Mon, 26 Jul 2021 16:13:52 +0200 Message-ID: Subject: A wrong bindkey command breaks the way bck-i-search (Ctrl+R) works To: zsh Content-Type: multipart/alternative; boundary="000000000000e8c9b605c8075da0" X-Seq: 26808 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: --000000000000e8c9b605c8075da0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, I created a few useful helper functions and bound them to specified keys. For example, pressing " inserts a pair of quotes and puts the cursor inside them, like this: "|". Another example, pressing a space fixes some of the typos I'm inclined to do repeatedly, e.g. pyhton is expanded to python. The implementation is quite straightforward, the widget examines LBUFFER and RBUFFER and modifies LBUFFER accordingly. _expand_abbreviations () { if [[ LBUFFER =3D~ 'this' && RBUFFER =3D=3D 'that' ]]; then LBUFER+=3D'something ' # mind the trailing space fi } zle -N expand-abbreviations _expand_abbreviations bindkey ' ' expand-abbreviations The problem with this solution is that it breaks the way that Ctrl+R history search works. Before, typing a space inside Ctrl+R just underlined the space in the offered string: % abcd efgh zsh: command not found: abcd % *abcd *efgh # the space is underlined here bck-i-search: abcd After using the " bindkey ' ' expand-abbreviations" command, the space finishes the Ctrl+R editor and inserts itself in front of the offered text: % _abcd efgh # a space prepended before abcd and I'm not able to continue with the bck-i-search widget any more. The behavior is identical for other bound keys, e.g. the double quote mark in the first example with quote duplication. I'm pretty sure there's something I'm missing in the bindkey command, but frankly, the documentation is quite complex and I'm not sure what to look for. Any suggestions are appreciated. Best regards, Peter Sl=C3=AD=C5=BEik --000000000000e8c9b605c8075da0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,

I created a few usefu= l helper functions and bound them to specified keys.
For example,= pressing " inserts a pair of quotes and puts the cursor inside them, = like this: "|".
Another example, pressing a space fixes= some of the typos I'm inclined to do repeatedly, e.g. pyhton<Space&= gt; is expanded to python<Space>.

The implem= entation is quite straightforward, the widget examines LBUFFER and RBUFFER = and modifies LBUFFER accordingly.

_expand_abbrevia= tions ()
{
=C2=A0=C2=A0=C2=A0 if [[ LBUFFER =3D~ 'this'= ; && RBUFFER =3D=3D 'that' ]]; then
=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 LBUFER+=3D'something '=C2=A0=C2=A0= =C2=A0 # mind the trailing space
=C2=A0=C2=A0=C2=A0 fi
<= div>}

zle -N expand-abbreviations _expand_abbrevia= tions
bindkey ' ' expand-abbreviations

The problem with this solution is that it breaks the way that Ctrl+R= history search works.
Before, typing a space inside Ctrl+R just = underlined the space in the offered string:

% = abcd efgh
zsh: command not found: abcd
% <Ctrl+R>abcd ef= gh=C2=A0=C2=A0=C2=A0 # the space is underlined here
bck-i-search: abcd&l= t;Space>

After using the " bindkey ' ' expand-abbreviations" command, the space finishes = the Ctrl+R editor and inserts itself in front of the offered text:
% _abcd efgh=C2=A0=C2=A0=C2=A0 # a space prepended before abcd
= and I'm not able to continue with the bck-i-search widget any more.

The behavior is identical for other bound keys, e.g. = the double quote mark in the first example with quote duplication.

I'm pretty sure there's something I'm miss= ing in the bindkey command, but frankly, the documentation is quite complex= and I'm not sure what to look for.

Any su= ggestions are appreciated.

Best regards,
Pe= ter Sl=C3=AD=C5=BEik
--000000000000e8c9b605c8075da0--