Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nkUGA-0006qC-43 for pgsql-general@arkaria.postgresql.org; Fri, 29 Apr 2022 17:18:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nkUG8-000355-BB for pgsql-general@arkaria.postgresql.org; Fri, 29 Apr 2022 17:18:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nkUG7-00034w-Vf for pgsql-general@lists.postgresql.org; Fri, 29 Apr 2022 17:18:23 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nkUG5-0001qE-SD for pgsql-general@lists.postgresql.org; Fri, 29 Apr 2022 17:18:22 +0000 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id B51322A0108 for ; Fri, 29 Apr 2022 10:18:20 -0700 (PDT) Date: Fri, 29 Apr 2022 10:18:20 -0700 (PDT) From: Rich Shepard To: pgsql-general@lists.postgresql.org Subject: Re: External psql editor In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, 29 Apr 2022, Francisco Olarte wrote: > I do a similar thing, but normally edit queries in an editor window and > just use selection or clipboard to paste them into the xterm where I have > psql running. I also used joe a lot ( its key sequences where easy coming > from wordstar(cp/m->msdos) ). Francisco, Joe can also be configured to use emacs chords which lets my fingers use the same keys in both editors. :-) > What do you mean by "here"? IIRC PSQL_EDITOR sets the editor for \e, not > for the psql command line. For that you could try writing a binding for > readline ( which you could also use in bash if you like them ) with the > joe keyseqs, but I fear it's editing model is a nit different. > I've done "PSQL_EDITOR=joe psql" to refresh my memory and it is in > fact as I remembered. > > The use of joe AS EDITOR for a single command can be done with the above > method. The use of joe keys for editting the normal psql line would > probably require readline wizardry. > > I've read joe has slave shell sessions. Other thing you could try ( I've > done it with emacs shell mode ) is use that, but I fear it only works well > with single line queries. Or look if it has some kind of sql modes ( > interactive sql, not sql-script-syntax-highlight ). Good information. Thanks. I'll dig into joe and see what's possible. Regards, Rich