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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 21777 invoked from network); 26 Jul 2021 15:59:24 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Jul 2021 15:59:24 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1627315164; b=XJoaqOQhZRxO8c29SITIzieqdRoXj4ER57Gq6EtEC4O4cbpYnE22NeWRBMMx5wmTUPQsTx8EGc itH9ca+nbWnI1iYfez99Z0+kUUl04EhToSo5SG3NA5yeXQa1vzifdAroNKsEEFyQDnyNMwcWX8 e1zpKuzdWcf9uNu5cUjQM0J2Z8xT61mFqXPfISRhIIVh60ZPDR3S/EUbCahqGkg0G9qHyHjecS Bg+/VAkUJ9Rfsdx+Tx1MVRmWftfLQ2rzTY8xPsSsMznQJZxLcg5bzNibyYAX/rWLQO+7JxMJ8y aJMVSX2LWVeZXLT+H0Hd3gWJ7wlx7sYVwrIIFNchMWfsdA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ua1-f43.google.com) smtp.remote-ip=209.85.222.43; 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=1627315164; bh=3v0HVeifZpl7CVRrdqXaLu3ONfF4jxGtEf1Tp6CKAUU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Cc:To:Subject: Message-ID:Date:From:References:In-Reply-To:MIME-Version:DKIM-Signature: DKIM-Signature; b=u53P850+gneGAWhbkEvbkgxviKpEiaZUi2dXjtj9A++zQsCWnLLF/MJvQUUswtAx1K3WPVT4RB GjySiQ2LNSsW8FqM1EPtqdpPil5PsR8J8kuwfs3kSbXwnYb7BkyT1sIwv+a3Fnf1h9VzOdcRCQ JZ8Rejyiq2vmotvW36mCI87lnmLOoq2XCo/t9n8zVKdZrUbwdVJJbKwnjin2p7fwFrNYvwLflh b7lczaM/dWMSad3cd/DU6hA0DIMqZwl6escqubA/b2N88pu1WPKNyGaz5ARhYViRtOXEwFF6An dVKP+eHKiHwT8VCLjy0OX8iVX3ndfDtJFwcA0jJs/dMzRw==; 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:Cc:To:Subject:Message-ID:Date:From:References:In-Reply-To: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=AKX3CRQdm8dOO6KniMVlP2JsLnc66teO/hMFlSXB+4s=; b=tu9a7UJhZcDG3D27TDEANQa4QM jP31ro46sWjuh8GebpGtgUB1jCoFjfrs4OFGTk6X+vQdNdi/MhuBjTAPuuMYxIk4TsaEj59Z40HNp HsMqO5h8OmL56jrT10jbGbPWFEboMzqjkwrr3xPp+4bvaYKWFKurJLGmbxud+V4d5VKjEjzm63DJ9 urfjf9gd7BO+G1+3uDoRREzl7ZEfLNzhmx760SdwvBxX8EPzPwoB7d92Y1VeHVsad/DsSc6ckr0jX nHrQuk972EdVdhQhBpxGMUtZ7bDUqQPXsZeU51v5RsD0mt93ipMLrEMurkSboP+2qnGHMWtoOEO2Z CIOKFZ+w==; Received: from authenticated user by zero.zsh.org with local id 1m830j-0001ek-CB; Mon, 26 Jul 2021 15:59:21 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ua1-f43.google.com) smtp.remote-ip=209.85.222.43; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-ua1-f43.google.com ([209.85.222.43]:40916) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1m82zq-0000vs-Vk; Mon, 26 Jul 2021 15:58:27 +0000 Received: by mail-ua1-f43.google.com with SMTP id 105so2416690uac.7 for ; Mon, 26 Jul 2021 08:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AKX3CRQdm8dOO6KniMVlP2JsLnc66teO/hMFlSXB+4s=; b=DOfZGqxFct3IAzIWQ0pQoRhgxEsaKA1SBi/WEQ72e5ztHNHkV4wcjnysK+TnafUBQo alsWdj89zxvUfysy2Q1z22WH+LwdFvlcf/1MFpqILTMHevHrlSJhUXd6B/317EWusX8r EWj2QrcxDYLSeAEMEzpXoSJ9AxBTnakS/IWSyYhbO70HJRJA2jt6coRGC2lPbTlH3w4n M/MUOI9Msp2IpEBVpxPWtIqpL5lYyeorjNImMpl1YBbNi41KmxXOYG/3QlwZLfUfgDz6 /bcXm0EGOpFEi2nK78DIYVyzklShR7871kis38JrSjTFaXLjoxiV4f3b7x8j8F/7FY4l l/wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AKX3CRQdm8dOO6KniMVlP2JsLnc66teO/hMFlSXB+4s=; b=P8I3lcji/Mi5Dq6K4Riar0Nr6YJrY2cLXASFrtbH8IEQQKtf4ei0P/N/KDp8GetkIF KbjhWuBkmexivXhMTk6y/GQlEpo7TetAoZvO8re9hIm8DexLMKcFG+KLIyfpO/+auAgt ZKHbXZ7Cvq0bfLrODc6Ho4hUydXOnQwl06GpvX58AayJHWuczegmpJMMrFy/WcGDYkzQ Kq1wFUSKad2sJrzTrn8l6bMxp1GHUDc/DsaI8S6E6n/vzl9LfIa3HuSpMnPPfM4aLT+H 8qfkHxbUnfjU4PpDVJUcasrldF3qSDp4v3lJI7jGBM9L3f8IrjHeQBJm+3m9yhHBFe6x hM1w== X-Gm-Message-State: AOAM533W1xnXMg9TIJU3GoM5rrbhtnG+7v2fJ1du7NP66e7yzdMHGvyb bMoBM9JL6SMryYJC3vF0mVnE8t8Yn9MMR0FD1j4= X-Google-Smtp-Source: ABdhPJxPojnI9s+vcRkjiNFJQfCr4lGxtDfI1Rn8GRq6eKSGGegQHLiwWfdLq2uMttp0KOiZvP+EPytoGuO3+nrAYaY= X-Received: by 2002:ab0:7e4a:: with SMTP id e10mr763531uax.77.1627315105792; Mon, 26 Jul 2021 08:58:25 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab0:1508:0:0:0:0:0 with HTTP; Mon, 26 Jul 2021 08:58:25 -0700 (PDT) In-Reply-To: References: From: Mikael Magnusson Date: Mon, 26 Jul 2021 17:58:25 +0200 Message-ID: Subject: Re: A wrong bindkey command breaks the way bck-i-search (Ctrl+R) works To: =?UTF-8?B?UGV0ZXIgU2zDrcW+aWs=?= Cc: zsh Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 26809 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: On 7/26/21, Peter Sl=C3=AD=C5=BEik wrote: > 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 insi= de > 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 tex= t: > % _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 mar= k > 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. You can use bindkey -M isearch ' ' self-insert to restore the previous beha= vior. --=20 Mikael Magnusson