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 32650 invoked from network); 27 Sep 2021 07:18:17 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Sep 2021 07:18:17 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1632727097; b=FBnCW7Z6zIjt5V3Zrc0rl0ViBb7X20lxBJdkqid9Ka9Z75AjOvwtND7i7uqVrZgOe0Qh6reaER 9M6a/VyIwvDEPM9qqLv+SmmD/0v9kSF/UZyWtFki70GjPbAPRSWUKGoHaFeNJFT9lv57WnUsgY Jw5PFKKS+WTEsE+YOCQMuhuNVoxHhtRh0yXiBbZGNphoG31/wlA2WQfN/DcU6sCNQjkEjodOVm CDo/fjFziuZhDffQdHEv5qadaWJHvdO6+ZhhPko2R/FUm+pj8mVMs6ZgkzTNUxdZV3NRkvaNTT +iZXdbjqMDYz2/8Q7kw3WoiIwFVe1W96PZifx9eEIY+Grw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-qt1-f180.google.com) smtp.remote-ip=209.85.160.180; dkim=pass header.d=gmail.com header.s=20210112 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-20210803; t=1632727097; bh=HtcuUlAxuqa0BaX3knsvg19jjClbWjkZpY6KxZk3bCo=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=aaugMEUj3OPl9VLIoWTtzq8rdPaAJ1J8BHfg+lGPcqrxlbhjFpUpL8S077jpoO82SGv2wB89Uu qbpN6muT2PuG8H2BZWo+FnT2IrPLa5a3i0drOd1R37LfNlBXRq0+M3f1l6BrJ1ART2u8MpWwGG UvvwGVbVJ1L+1a8rh1CYNQwND7xq+gcuk2GE48N4pJcRBrHwufSAOZ46vQTShwl49WrK7ppe/3 TIH1aeKUHy5QSLhjlQBaFxXHcwM6/inqb0OXgHRHF3RItDIWW9OEHP3UgL0f95zJLFWfLVEhxm x1E/rAEKSpCtnFusX2n7N1OZAeexc2qVrDT/PhLqqgSmUA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=tnoBridLIKGyM2M/2JPG/MVXQy0mbPSzYaf8aqJ/Z+k=; b=CzXO4AgOMQWPoBI/OSQf1yxOR0 +1woOHfoJw650A9v2KhVD76qm6w6IeO/QZMvO7EXLAeLi89e1mo8a7Hbhox+FC1hg6UQeJQxRl1R+ GKAOW+h2K/lliwp6JgHuXsLREbXGMz+wNZJOqx7drlRWFW2WRXPmmcwte0wIRvtLXIunqcCj9smJG A0xo4BwdMBDkDqdhvtIKKVdp3BdhpwSUoc3rZjBFuPdiYXFokcljzoIOr2KkdWR235Lq8n3QH7aKZ h1h2sKcN7su78ibJ1/egxs1nmHsKwSiBzH1pAmwxn9WdDR/zgZPBizkIFqVneBukxp7ejzUFBnzl/ ZlAiMH0g==; Received: from authenticated user by zero.zsh.org with local id 1mUku0-00015e-BP; Mon, 27 Sep 2021 07:18:16 +0000 Authentication-Results: zsh.org; iprev=pass (mail-qt1-f180.google.com) smtp.remote-ip=209.85.160.180; dkim=pass header.d=gmail.com header.s=20210112 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none Received: from mail-qt1-f180.google.com ([209.85.160.180]:35565) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1mUkt1-0000NP-Vy; Mon, 27 Sep 2021 07:17:16 +0000 Received: by mail-qt1-f180.google.com with SMTP id c20so15823083qtb.2 for ; Mon, 27 Sep 2021 00:17:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tnoBridLIKGyM2M/2JPG/MVXQy0mbPSzYaf8aqJ/Z+k=; b=o1YSZS787PmZ9gflEGBgpHGj8AIrwrUgJwxCP/4P3NSFWdCwE9YpE5IUrjAYXox+i1 aaHuyb/kmdzByakG4QfilFzeQth8+Rd0gDrJAt3m64XwSn4djcIdH9LVeCds7xg0yijW iIsIjw3EtYwUt8bE8nXhe95JOiSHjzXP5iOER4dpjXjqXjPHNMcVtfxqMdBVT5gZQlVu qKF/o3DBs4D+lXjL8hWa94V9E7i30NdDWQ2n17XKRwX8H3fKws/4xScPmToee9ZC2C2i nCwRoQraSXOpjknYZKe1UsnaBvRuPO4vq6OA1rqm3rrte0tUg0P3YoZsYc4GOQAbuq0d gQiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=tnoBridLIKGyM2M/2JPG/MVXQy0mbPSzYaf8aqJ/Z+k=; b=cSVe23r1XW68RCgG3PnI8FjNlnPrEQUCS9TvCVSnpjYO8QquHo/R1zjWPwI2gCSu2u rWhRLCKKdOJ8UBqV7Ei6/f41v6A6jw59IX9guQwYFIlRoR87SVWKDvCJWFZN1QDne1cM NLkzLzfrAUY1gRF1OcIg5OSayVB381tGgGb9LoKsnzmjyacWQu4yXDmjjaSe2gA2Wr3q j/gT/V5xdv+9rD/eGiRQIZuo/Tp5TvVw+QAhJv9Yvk5ENdGSfqyy+kCGjWsqn/QdoWLw BWyg7ObmPG0fiCWv7OBQc+rr5siLJPNuLuYKvFhIVJGYSh+hcPP/eGxwZ1dm94fKTEEX D3Yg== X-Gm-Message-State: AOAM533u1Sjrp9ycdBolFOMC+Ay+o49HGYBQ1irpJMPrvR1JxdOTLbJG zZoCwgVzG0B/VaQunydbJ4bdgHcMU/Sdnw2Cm6M= X-Google-Smtp-Source: ABdhPJwb6TVLYswZP8r++/5S0jxNTNWwgqB3CuX3fJqK1nvvQRmC8iAuElvIoIbviylIIKOxwsF6L8WvB2Abu6zEJrI= X-Received: by 2002:ac8:5287:: with SMTP id s7mr17306971qtn.359.1632727034049; Mon, 27 Sep 2021 00:17:14 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ahmad Ismail Date: Mon, 27 Sep 2021 07:17:03 +0000 Message-ID: Subject: Re: Select Whole, When There are Multiple Lines To: Daniel Shahaf Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" X-Seq: 27139 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: I did not notice it earlier. The following also works. .... _select-whole() { zle beginning-of-buffer-or-history ((REGION_ACTIVE)) || zle set-mark-command zle end-of-buffer-or-history } zle -N _select-whole bindkey '^A' _select-whole .... However, it works weirdly when used on single line. What can I do so that _select-whole works on both single and multi-lines? Thanks and Best Regards, Ahmad Ismail On Sun, Sep 26, 2021 at 7:08 AM Daniel Shahaf wrote: > > Ahmad Ismail wrote on Sat, 25 Sep 2021 11:29 +00:00: > > I mean when there are multiple lines on the prompt, the keybinding > > only works for the line where the cursor is. How can I select all > > lines using ctrl-A > > This works: > > f() { MARK=0; CURSOR=$#BUFFER; REGION_ACTIVE=1; } > zle -N f > bindkey '^T' f > echo foo^V^Jecho bar^T # In this line, ^X means to press Ctrl+X > > It doesn't work in some other cases. It works when $BUFFER is > multiline and $PREBUFFER is empty, but it doesn't work when $BUFFER is > single-line and the previous content is in $PREBUFFER. You might be > able to simulate that with 'P' ranges in region_highlight and > overriding widgets that operate on the region, but it might be easier > to just use edit-command-line.