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,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 31564 invoked from network); 25 Oct 2020 20:24:49 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 25 Oct 2020 20:24:49 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1603657489; b=A6upjgvQvlq6fPVt4Sso2Ya4Hsc4mr93o5f/aS8wIltncBZnlVMnQ/j3z7827vTLHi6I6IPy/c uMpdcFCr3C3nN9yGFBH0qqqmUWSQ0KAvDJqmQOtX8gPZjwzbKGc6Q9n/zvHBKq74uMSfKku1/v ZHDQl1476oOvYgkAQNYvcBYrc9X/aNJJBbEm+wdPsEPTQW/J0j9qhV0pdz/ddRC6VTKpEZtugz 1tSO6PeLN2Yg8/s5XBdepo7cTFcH9Y7COc+IQZZ3pu/wlawa5O8DIRzaHMiKtt+152hW2PdZb8 Co3sr33sS5cLGR6bH0+klEYo41c0yarZVn6iFUPwu4sP7A==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1603657489; bh=D5x4XQCxTlkog3QSpfH5J2fIQsK7wd2er6CPNUDAkuU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=jAbAy2mgCQ43Sc0vv9FebtEfwIypeJl6kYz3Wh+AX/hf3rZ8Gi1gHExSbVMhgLcjsdCigVNj4v tvv3doea1EAtV1stSpT29rdVkstR/3TD/2Rap2bCiEaeaD0TbE4dBT+gMzOKSKVVDr2H63Sb+u 3QD46w8owMhW5yJwx7APlt0SBMHwkr5v4EGiBemIFmI6BOA3/t/FN7vzYlr84jUjo9jjOpSpjr rUeZPxg9ifwpROzZwu1lzQUSsSeo0n4BqURvh5lxDYa2TfgnJmWBh9VF9Sme/Wsr4DRGdupXpf jFWDZl6nvIUKn9wPPbvkYdBK7M6DpUYdJVHJ8mybOXlr1g==; 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:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=shg3hiGZR0kNckBCGwfAZPPA+nJNxVMekfsMm9EvbLw=; b=juSCM9Ne5f0rCgWJ5VE4u3acW5 b0Oxd7s0X/8BjkEpJkIxi2wwnQohO/hxML2LdogrmcIoUyqZweOe81T1Pj8uvgsO/sHMCpif86HYo h3ZkqmF7ns1eLradGLWw3h0dowYGxlzTnKAZwZCeZ9yFbIYP8IVlPKXMY9BKeej7nIG7O91kFZYgb +Hdg5tejuIEVmN3751IDJQoTpiomSB6saL1WLeL0C1orTtF3VTnEhbsSQQQLWzz/Hba6KQ5RLj5Od Ad7S2CjJdkuhJaiMY5ivCyetshbDMURE3uPEZjRjZSh+sqgnqkGb10BNFLkWz1dXCmdQdnhuekLul f5i5tqkg==; Received: from authenticated user by zero.zsh.org with local id 1kWmZN-000AyZ-1G; Sun, 25 Oct 2020 20:24:49 +0000 Authentication-Results: zsh.org; iprev=pass (out4-smtp.messagingengine.com) smtp.remote-ip=66.111.4.28; dkim=pass header.d=daniel.shahaf.name header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out4-smtp.messagingengine.com ([66.111.4.28]:40717) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kWmYx-000Abm-SV; Sun, 25 Oct 2020 20:24:24 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id D54DF5C00E3; Sun, 25 Oct 2020 16:24:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 25 Oct 2020 16:24:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :in-reply-to:references:mime-version:content-type :content-transfer-encoding; s=fm1; bh=shg3hiGZR0kNckBCGwfAZPPA+n JNxVMekfsMm9EvbLw=; b=xC1sV8kXwD+RGZ0rZR9X9kUUunfRv4oQLAgH3CZaXv AIndQBHY0EnDIbvy1XglX4DfaBQyoN3esN3NYmo5yGKIGkfRqRaUVkCDm654XPOj 3n+ddyaxNdB2tpc9JTDzXMwRih3oPcqpPvsAA9JLX95B9g2w8hD4ub7io3ix0M6X Q0n45KvB5sTHz7l2pIxCcniHB8FY2tc4+3x/otKE73P7BSTBdu2M8Zc3gi16Bnbs ESBBOea8C+hB9YSp7CeFSVhr9jzSO5CvFQaGytuPIF+gPtyBHIH7SyznzKqvWuY1 /pqUdvVCN3wBl18HRddnVnS0gYQ8iRs1g09McINgFRqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=shg3hiGZR0kNckBCGwfAZPPA+nJNxVMekfsMm9Evb Lw=; b=IbmWgJ/WttQSJXyQ0xIJ/DuJcZRZJW5m77mVHouRGe03FwvaV9wElHOdT IIXuwt9rT05OxbNcBo3MprXvunbc3cf5lrfsWuL8J3BX27yXzdKM57ieOToevHwE WnDKIVV3dScJi6bZamrn4yN3YvjwKLmaYbbDlobud4ByYsNmtK3LNNUVgCpPN0C3 szg3wfz2RCdE0vIt6tidAGbJu7ZB4qxkk+QRDNx6r7cOPL+2OYnxXXrPNLZNyiwM KsD/p7MFEbGSmX6diTKi27F+LJGaX6zI6PIWyLeKtVo0uIejnz8fqCLNrGsZlOqP PyT81cnqEYqeWU2ATsWXiU43Dg4qg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrkeeggddufeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfgjfhfogggtgfesthhqtddtredtjeenucfhrhhomhepffgrnhhi vghlucfuhhgrhhgrfhcuoegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvgeqne cuggftrfgrthhtvghrnhephfdtteefheevuedthedutdeifeegteettdejtdffheduieei jeelteetkeduteehnecukfhppedutdelrdeiiedrudefrddvvdejnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-109-66-13-227.red.bezeqint.net [109.66.13.227]) by mail.messagingengine.com (Postfix) with ESMTPA id 5851A3064674; Sun, 25 Oct 2020 16:24:22 -0400 (EDT) Received: from tarpaulin.shahaf.local2 (localhost [IPv6:::1]) by tarpaulin.shahaf.local2 (Postfix) with ESMTP id 4CK8ZX57MKzvn; Sun, 25 Oct 2020 20:24:20 +0000 (UTC) Date: Sun, 25 Oct 2020 20:24:19 +0000 From: Daniel Shahaf To: Ahmad Ismail Cc: Zsh Users Subject: Re: save a command in history from within the widget Message-ID: <20201025202419.528548e8@tarpaulin.shahaf.local2> In-Reply-To: References: X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Seq: 26129 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: Ahmad Ismail wrote on Sun, 25 Oct 2020 01:00 +0600: > I am currently working on a widget. It is used so that I can use my git > alias also for my dotfiles. >=20 > The widget is given bellow: =E2=8B=AE > Now, the problem is, the commands I am invoking are not being saved in the > history file. > For example, if I use: >=20 > % g d add-and-commit "Few Modifications" >=20 > it saves: >=20 > : 1603565685:0;git d add ~ && g d commit -am "Few Modifications" >=20 > I know the command below is the command I actually ran. But I want to save > the command I used as well. Is there any way I can save a command in > history from within the widget? I don't understand your use-case. You stated your purpose is to use your =C2=ABg=C2=BB alias in your dotfiles, but then you gave an example from interactive use, and in any case dotfiles don't run widgets. In any case, I'd scratch the approach of checking [[ $BUFFER =3D~ '^g d foo= ' ]], because it'll break as soon as you want to interactively use complex commands (e.g., sublists, lists, conditions, loops). I don't understand why you can't drop a script literally called =C2=ABg=C2= =BB into a directory in $path and implement in it whatever logic you want. (Or possibly a function, depending on your use-case.) As to your widget code, you don't need kill-whole-line if you set BUFFER explicitly. Also, you check BUFFER without first checking PREBUFFER, which is subtly wrong because $PREBUFFER may end with a line continuation. Cheers, Daniel