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=0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_SBL_CSS, UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.4 Received: (qmail 20001 invoked from network); 23 Sep 2020 11:22:00 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 23 Sep 2020 11:22:00 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1600860120; b=HiTFiF3HygdiOE7Rbs8jCkfJPNnnM9lo7Q6aO+MbIYPdsXvP7rM+b/PpWJJ+l/46C3F0fxI6sS XZPQ1ImcENSFiWtTvPwGr/yybwCJZBco5rZ9OLhTIo4kfEPdsorsz/KSZbd9Af8lQ5q074OdTn h9vTBgpumnNNoSnMjKH1QhmUhhnFxIbACx46TiCeCP4onZgxJ3y4yqt5ftrKt9bJtEtov/u1yh hMdQM7hoJdpR8qjxA2UF/wQ/zoCcZ6O2iDmuZYaLdsBJ71qHes1kA4wMMlRD6tiaXmdYjB6ecS mM/C1+h9SUWt5Am09vj/7RZKa4baa2ZDO9ifaUaYKKPHew==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1600860120; bh=44IU85xdWOahWlR5z2Dx5M4xPtar6d18OTBCODgQzTM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject: References:In-Reply-To:Message-ID:To:From:Date:DKIM-Signature: DKIM-Signature; b=Af7NxLxazJfa5DJSGoA6oGTXk4ogRyrZ2TJxlesYc7gDWJcoVHIC8oWvDajHHXw5QGYNAf70gv stRV+MHqp7U2FtihaLIwy/pI3QtGDbt+rhjUIOz+5Cy4b00Xt7cqxA8wji8BLXnW+RQtibFRE7 cyz3mYRxxBf28Mc0COAaLeJdAaOLnd0fWEG5UcWsYzuU92ylM6ifYjOLO8HHT+etaekxtE367J u0XAOUGe4wbR8DH4UkDwWqw1lmXsUwy5Htv4Y/2Z9BZy/ho5+yD1CqjZvZnT3DP8eGqMFJJgGP P/3Tj0OjqnMGjrFgmY2FM0K9gMxIdyxqyyMGmU37POAfSA==; 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-Transfer-Encoding: Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID:To:From: Date:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=ZWuz8+OK7HDR7wfeCPYy9QZvb1qOYnbdLUPxGle3pLc=; b=KZa+OLyXXnKSib8sZlcW5uxYjy I5859zD/TBi5Kr1d7Haye7Pc8F3mGTyhQ3yBJkgAsb5crgXfOc7Qki6XS1qoYknItiaOVMYu3ly12 g11BMfoEwYy4uT6WyEDq+wY5IdC85CiUJAXXeTivxroqdYTxqbo/dbZOlSirKTtCv1ZCqx9eHn0R6 q0dUmN3gkE7ucwmv/rkzyb/6/Rrfmhe2vmQECviWCGxWlw7XzvxIADSGUh288i6v+TzzLOhCKAdcl NO6xRo4EQkaXv1aUB8Fh4u0tl0Z4dj4XUontkZTz041/FzE2q6G3lM2NcHwvY49fCG0Dl4rlkFJLd ONRByhtg==; Received: from authenticated user by zero.zsh.org with local id 1kL2qV-000CGi-Pn; Wed, 23 Sep 2020 11:21:59 +0000 Authentication-Results: zsh.org; iprev=pass (smtpq1.tb.ukmail.iss.as9143.net) smtp.remote-ip=212.54.57.96; dkim=pass header.d=ntlworld.com header.s=meg.feb2017 header.a=rsa-sha256; dmarc=pass header.from=ntlworld.com; arc=none Received: from smtpq1.tb.ukmail.iss.as9143.net ([212.54.57.96]:60090) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1kL2q3-000Bti-Uk; Wed, 23 Sep 2020 11:21:32 +0000 Received: from [212.54.57.82] (helo=smtp3.tb.ukmail.iss.as9143.net) by smtpq1.tb.ukmail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1kL2q2-0007BH-AL for zsh-users@zsh.org; Wed, 23 Sep 2020 13:21:30 +0200 Received: from oxbe24.tb.ukmail.iss.as9143.net ([172.25.160.155]) by smtp3.tb.ukmail.iss.as9143.net with ESMTP id L2q2kOp1CMVrfL2q2kqT6Y; Wed, 23 Sep 2020 13:21:30 +0200 X-Env-Mailfrom: p.w.stephenson@ntlworld.com X-Env-Rcptto: zsh-users@zsh.org X-SourceIP: 172.25.160.155 X-CNFS-Analysis: v=2.4 cv=Ceq2WJnl c=1 sm=1 tr=0 ts=5f6b2fba a=7eg3RIOFpSGgz8rG3xBEDw==:117 a=KEnZaF_ea6UA:10 a=IkcTkHD0fZMA:10 a=DoY9bV0jb9AA:10 a=pGLkceISAAAA:8 a=jafVGGcb6YSNbEwPlB0A:9 a=QEXdDO2ut3YA:10 X-Authenticated-Sender: p.w.stephenson@ntlworld.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ntlworld.com; s=meg.feb2017; t=1600860090; bh=44IU85xdWOahWlR5z2Dx5M4xPtar6d18OTBCODgQzTM=; h=Date:From:To:In-Reply-To:References:Subject; b=wXEX9lj7IspAAg4Z6Htqy9GuDXG4zyvMhxfIIgv2yhooh+LTZR8XkX0rwa5FMQMhM MRIk7TjFbZgHJKjCXwV4Vo+c9ZwWuiWzPXNB0bI0qS1TIT4C0Wuer6NAU6xBDzcaIJ 24zZTmk0N/rjXrIcwhF07HTx2X2De65DUTYu/0sE/m1YEurXo2xPodmfRtZ3l7ATZL 3KZWupGk1Ma0JG+p+B0EqAeL3csDPQiemLSl6g6yFJNrJvi0P/hfrF2Wo51VTiJCWA kldbwKQZd0Xa/kSl1P6uNs4xS/WqObVU6mFj6Suc1ObqqIZ8ckB5fe05H1yMRyQq8I jbL5xycl1UX/Q== Date: Wed, 23 Sep 2020 12:21:30 +0100 (BST) From: Peter Stephenson To: zsh-users@zsh.org Message-ID: <2017958989.2143187.1600860090233@mail2.virginmedia.com> In-Reply-To: References: Subject: Re: How to avoid infinite recursion in ZLE widgets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.4-Rev72 X-Originating-IP: 165.225.81.56 X-Originating-Client: open-xchange-appsuite X-CMAE-Envelope: MS4xfLHHgSpmMdv7n+asOn8wtY9k784ljYpb5dAsawnK2spjTr4jqxsQ7+dR7XtbeaKRVpwUJJSoqxo+Rh+0k+omZmDnJ68PKMUnXPeN9enS9M13uuW7BsbE heCVIrVg4jBI4vfUPw2aqVK3wA/IxzzUty4GCsxLKn4yE8DF0G+fX0mDc2m0YP4ggpfDwD2DsEdvJjaFi9MyruRdqbGkFHNbPawwilrGWsqesvdodeGy80IX X-Seq: 26074 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: Archived-At: > On 23 September 2020 at 09:34 Peter Sl=C3=AD=C5=BEik wrote: > I'd like to replicate the functionality found in some text editors - name= ly > that if you press a single or double quote, the editor inserts two of the= m > and places the cursor inside the pair. >=20 > With some necessary checks for word boundaries, etc. left out, the soluti= on > looks rather trivial: >=20 > function insert-single-quotes() { > zle self-insert "''" # that's "_'_'_" > zle backward-char > } The right way to insert something into the buffer at this point is using the special variables. You can add a quote before and a quote after the cursor using: insert-single-quotes() { LBUFFER+=3D"'" RBUFFER=3D"'$RBUFFER" } pws