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 1nkTil-0005I1-85 for pgsql-general@arkaria.postgresql.org; Fri, 29 Apr 2022 16:43:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nkThk-0006fM-JI for pgsql-general@arkaria.postgresql.org; Fri, 29 Apr 2022 16:42:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nkThk-0006fD-4V for pgsql-general@lists.postgresql.org; Fri, 29 Apr 2022 16:42:52 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nkThh-0006SL-8G for pgsql-general@lists.postgresql.org; Fri, 29 Apr 2022 16:42:51 +0000 Received: by mail-qt1-x833.google.com with SMTP id t11so6152558qto.11 for ; Fri, 29 Apr 2022 09:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wi3ck-info.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=7kn6IYzHKBTWaDSdnI2+natTuv412ZFFa4i+IZGW5kk=; b=7nCR2+IPniC7ldzTs89g+p7nNB3HimVxUhNGXsbiZ2MPeztOkBfrQYUclZCLI1rNOj 4ya3DQ1/SVa9atTDUh4PMoQGay9HFoEk3gGi9mVzw1Y86l92yVO8oN5MtP4dVIWKcwF+ HefRvMzfTWjyTm1jWyUYxcE3p+3f/GN2kkauY/r39FP6dq2iZ/Oi38aGp2Yr/DQhf4A6 9IyJG0OjtH9O1iBt3reKJgiTDZgdgSkoG/xsy7FsqjVp7WPGeSX3m787n/cmGGmSqTRx LZ/QUFhXLGZX1CD2DEH0jJRD7f2MlQRhvXbjTpT/rPjs8Pb7PZr3M3k+iKug1I107HuH C0bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=7kn6IYzHKBTWaDSdnI2+natTuv412ZFFa4i+IZGW5kk=; b=faN3/qE8K50w27eULMzMWnYitYzulBnVYgh2M+p995Dh1tLxNs1H+x/7O02dZKOZ58 wiEZU2Pzpnqb6N7ccfmt2BOIGjT5EaLe14gv0s0qhUiAQBzIWhkfIeZOHV8uuKlPL1m0 o+ju5VI81YqJV8NKTG0clQLeYWiG3lW4Ugj8jAYiEsryb5gaxdzL9X2OqyiQb7Xpg2wg mIj1hpB/4q+eNmr3smjWA1lxEtYk/VLBN8A57bPKstSdugwazlnDNX5xZ11GtKspo4J0 QP9kdtrdL/noGTfHK+0mH5nXiBkLjGEFEnTruLBJi+BwuD/V/XFcHMaY+HY5ogPAdqwT qV3g== X-Gm-Message-State: AOAM5316c0sqaicj3jCHCx3NmBALaBNsCvg9+SNx0jdWrzDi1ZPYc8Y6 gr3tb3SfDqEBz5shaRs4chqyNA== X-Google-Smtp-Source: ABdhPJwKCC001CqsZ588pLOXYPkN33GCBi0ly2LkmkE+yyLgQ79V9XrI/8mcSdoAUsFihHmlEL/WrA== X-Received: by 2002:a05:622a:551:b0:2f3:8c80:782a with SMTP id m17-20020a05622a055100b002f38c80782amr236243qtx.181.1651250566397; Fri, 29 Apr 2022 09:42:46 -0700 (PDT) Received: from [172.21.8.10] (pool-71-244-100-177.phlapa.fios.verizon.net. [71.244.100.177]) by smtp.gmail.com with ESMTPSA id t193-20020a3746ca000000b0069f70bc6cf5sm1628488qka.1.2022.04.29.09.42.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 09:42:45 -0700 (PDT) Message-ID: <7fef2d5f-6698-0bb5-11fe-ffd042a24ab1@wi3ck.info> Date: Fri, 29 Apr 2022 12:42:44 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: External psql editor Content-Language: en-US To: Rich Shepard , pgsql-general@lists.postgresql.org References: From: Jan Wieck In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/29/22 11:55, Rich Shepard wrote: > I do all my postgres work using the psql shell. Editing a command reguires > moving character-by-character and I'd like to use my small text editor (joe) > because it allows more control over line movement. > > A web search found a stackexchange thread that suggested adding to > ~/.bash_profile the line: > export PSQL_EDITOR=/usr/bin/joe > so I did this yesterday. > > Today I've learned that the keyboard chords I use in joe in other > applications aren't working here. For example, C-w should delete the word to > the right of the point (cursor location). It doesn't. Instead, it deletes > from the cursor postion to the head of the line. C-x doesn't move the cursor > one word to the right, but cancels the command. > > Is there a way for me to specify use of joe at the psql command line? (I'd > use emacs but that's gross overkill.) What you are missing is that even though the PSQL_EDITOR env variable is set, psql itself doesn't emulate that editor's behavior natively. You need to actually launch the editor (possibly while having a partial query in the buffer) with the \e command. While in psql, type \e and Enter. You will have the current query buffer in the editor. You can do this at the end of a partial (not yet semicolon terminated) query. Best Regards, Jan