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 949 invoked from network); 30 Aug 2021 01:27:39 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 30 Aug 2021 01:27:39 -0000 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:Subject:Cc:To:From:Date: References:In-Reply-To:Message-Id: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=1fwpUHv5DHPgpTvKTBlRxeUTd4FGogevMqnogUxw7bQ=; b=eTSaDMFuS0x+UPLi6A5nreILNB C0dfQQ8zpB0zVgfczNTyLma/IHGbXRBmEimqdkhDoaShrOJ+9MfHRi/0dfZrJtb4NfVRWDIowxWam mJx4UlARojh09vOQz0QYcozuWqqRaTnSmCadBoWFg8Z7EyaUd1hjyWlXweWBzKellRbrLsrC6QLDo 8nFYEkKx2L+qr4ZqJGOPysSkof5Eqte6UKJReQcwoqK5b7/OfortE55ubUGjRyyZsro1EiO3wh9VI o5tD8y21bB19rtzKw7r0wMFOggMxnsSKRI/FKGhdfZd/SSZka+4vBoyXjpaCnw2wW3upw0FhW4a/j 3lOb1T5g==; Received: from authenticated user by zero.zsh.org with local id 1mKW5L-000GDv-0j; Mon, 30 Aug 2021 01:27:39 +0000 Received: from authenticated user by zero.zsh.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1mKW4X-000FUB-Pp; Mon, 30 Aug 2021 01:26:50 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 85FB927C0054; Sun, 29 Aug 2021 21:26:47 -0400 (EDT) Received: from imap2 ([10.202.2.52]) by compute3.internal (MEProxy); Sun, 29 Aug 2021 21:26:47 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddukedggeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsehttd ertderreejnecuhfhrohhmpefnrgifrhgvnhgtvggpgggvlhojiihquhgviicuoehlrghr rhihvhesiihshhdrohhrgheqnecuggftrfgrthhtvghrnhepjedvleettddtueetkeejfe ffhfekieevhfegffekkeejkeeltdeutdelgfekfedunecuffhomhgrihhnpehgihhthhhu sgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehlrghrrhihvhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqudduhedu keejjedtgedqudduledvjeefkeehqdhlrghrrhihvheppeiishhhrdhorhhgsehfrghsth hmrghilhdrtghomh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id CC50FA00556; Sun, 29 Aug 2021 21:26:46 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-1125-g685cec594c-fm-20210825.001-g685cec59 Mime-Version: 1.0 Message-Id: <2db828ff-20c7-463d-bcad-1d62813936dd@www.fastmail.com> In-Reply-To: References: Date: Sun, 29 Aug 2021 21:26:09 -0400 From: =?UTF-8?Q?Lawrence_Vel=C3=A1zquez?= To: "Steve Dondley" Cc: zsh-users@zsh.org Subject: Re: Unable to successfully set up FZF_DEFAULT_COMMAND Content-Type: text/plain X-Seq: 26989 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 Sun, Aug 29, 2021, at 8:36 PM, Steve Dondley wrote: > I'm running MacOS on a fresh user install. > > I'm trying to integrate the 'rg' command with fzf. The README page for > fzf says to insert the following line into .zshrc: I assume you're referring to this? It doesn't say anything about .zshrc. https://github.com/junegunn/fzf#3-interactive-ripgrep-integration > INITIAL_QUERY="" > RG_PREFIX="rg --column --line-number --no-heading --color=always > --smart-case " > FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \ > fzf --bind "change:reload:$RG_PREFIX {q} || true" \ > --ansi --disabled --query "$INITIAL_QUERY" \ > --height=50% --layout=reverse > > When I do add these lines, there are two problems: > > 1) When I reload zsh, the fzf command gets run with the rg command > immediately. > 2) When I type 'echo $FZF_DEFAULT_COMMAND' at the command prompt, the > FZF_DEFAULT_COMMAND is not set. And then when I run 'fzf', I'll just get > the default fzf behavior. Indeed. The command you quoted is of the form FOO=bar cmd arg1 arg2 arg3 which runs cmd with FOO in its environment. FOO is (generally) not put into the environment of the executing shell. (In your example, "cmd" is fzf and "FOO" is FZF_DEFAULT_COMMAND.) I'm not familiar with fzf or how it's intended to be used, but the fact that that command runs fzf immediately makes me think it's not supposed to go into a shell startup file. > When I try adding the "export" keyword to export the FZF_DEFAULT_COMMAND > but that results in an error: > > /Users/test/.zshrc:export:3: not valid in this context: --bind. And > 'echo $FZF_DEFAULT_COMMAND' shows just: > > rg --column --line-number --no-heading --color=always --smart-case '' You took FOO=bar cmd arg1 arg2 arg3 and turned it into export FOO=bar cmd arg1 arg2 arg3 which exports FOO. In your example it also exports a variable named "fzf". The other arguments become arguments to the export command itself, which causes some trouble. > I've searched around a great deal but I'm coming up empty. Can someone > explain why I can't get this working? Perhaps you want this section? You will have to adapt their example to use ripgrep instead of fd. https://github.com/junegunn/fzf#respecting-gitignore -- vq