Re: psql command line editing

From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: psql command line editing
Date: 2025-02-12 20:03:53
Message-ID: CANzqJaDON5n_covMuRLA2WKTxrnG_xGYENer84GAjKSWDTH+QA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Feb 12, 2025 at 2:29 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> > On Wed, Feb 12, 2025 at 1:50 PM Rich Shepard <rshepard(at)appl-ecosys(dot)com>
> > wrote:
> >> My web searches suggest that using the psql command line I'm limited to
> >> moving the cursor one character at a time. Is there a way to use a small
> >> editor, e.g., joe on linux, to move by words or to the begining and end
> of
> >> the line?
>
> > The PGDG prebuilt packages are built with libreadline. Thus, if that's
> how
> > you installed psql, Home, End, Ctrl-Left, Ctrl-Right and Ctrl-w should
> work.
>
> On my machine, Ctrl-Left/Right don't seem to do anything, but
> the usual Emacs combinations Ctrl-A, Ctrl-E, Escape-B, Escape-F
> and so on work in psql. I don't believe I did anything special
> to configure that. Check your local readline documentation.
>
> As Adrian notes, there's also \e, which is good for entering
> or editing multi-line queries.
>

There's got to be something in your shell config which says "use emacs
keys" instead of "use vi keys".

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-02-12 20:29:35 Re: psql command line editing
Previous Message Rich Shepard 2025-02-12 19:54:47 Re: psql command line editing