Re: psql command line editing

2025-02-13 Thread Rob Sargent
On 2/13/25 12:11, Ron Johnson wrote: It appears that the RHEL default /etc/initrc file defines a bunch of escape sequences "for linux console and RH/Debian xterm" cursor keys when in emacs mode. Our servers are RHEL, my ssh client emulates xterm, and is in the default emacs mode.  Thus, th

Re: psql command line editing

2025-02-13 Thread Ron Johnson
On Wed, Feb 12, 2025 at 3:29 PM Adrian Klaver wrote: > On 2/12/25 12:03, Ron Johnson wrote: > > On Wed, Feb 12, 2025 at 2:29 PM Tom Lane > > wrote: > > > There's got to be something in your shell config which says "use emacs > > keys" instead of "use vi keys". > > Fro

Re: psql command line editing

2025-02-13 Thread Adrian Klaver
On 2/13/25 09:20, Vincent Veyron wrote: On Wed, 12 Feb 2025 16:21:21 -0500 Tom Lane wrote: I do have export EDITOR=emacs Possibly libreadline is reacting to that, but I've not checked into it. Emacs combinations work on my machine without it. See my answer here: https://www.postgresql

Re: psql command line editing

2025-02-13 Thread Vincent Veyron
On Wed, 12 Feb 2025 16:21:21 -0500 Tom Lane wrote: > I do have > > export EDITOR=emacs > > Possibly libreadline is reacting to that, but I've not checked > into it. > Emacs combinations work on my machine without it. -- Bien à vous, Vincent Veyron

Re: psql command line editing

2025-02-12 Thread Ben Hancock
On 2/12/2025 11:44, Rich Shepard wrote: > I run psql from a urxvt virtual console, not emacs (which is where I > write scripts.) As with everything in Emacs, there's a mode for that. In case you're not aware of it, sql-mode allows you not only to interact with psql from within Emacs, but also to

Re: psql command line editing

2025-02-12 Thread Tom Lane
Rob Sargent writes: >> There's got to be something in your shell config which says "use emacs >> keys" instead of "use vi keys". > Or something in yours setting vi? I do have export EDITOR=emacs Possibly libreadline is reacting to that, but I've not checked into it. r

Re: psql command line editing

2025-02-12 Thread Rob Sargent
There's got to be something in your shell config which says "use emacs keys" instead of "use vi keys". -- Death to , and butter sauce. Don't boil me, I'm still alive. lobster! Or something in yours setting vi?

Re: psql command line editing

2025-02-12 Thread Adrian Klaver
On 2/12/25 12:03, Ron Johnson wrote: On Wed, Feb 12, 2025 at 2:29 PM Tom Lane > wrote: There's got to be something in your shell config which says "use emacs keys" instead of "use vi keys". From man readline: "By default, the line editing commands are similar to th

Re: psql command line editing

2025-02-12 Thread Ron Johnson
On Wed, Feb 12, 2025 at 2:29 PM Tom Lane wrote: > Ron Johnson writes: > > On Wed, Feb 12, 2025 at 1:50 PM Rich Shepard > > 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 > >> edito

Re: psql command line editing

2025-02-12 Thread Rich Shepard
On Wed, 12 Feb 2025, Adrian Klaver wrote: The point Tom was making is that psql uses readline for it's editing positioning and that for him Emacs movement commands work in psql. Adrian, Thanks for clarifying; the emacs commands work for me, too, in psql. Regards, Rich

Re: psql command line editing

2025-02-12 Thread Adrian Klaver
On 2/12/25 11:44, Rich Shepard wrote: On Wed, 12 Feb 2025, Tom Lane wrote: 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

Re: psql command line editing

2025-02-12 Thread Rich Shepard
On Wed, 12 Feb 2025, Tom Lane wrote: 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. Tom, I

Re: psql command line editing

2025-02-12 Thread Tom Lane
Ron Johnson writes: > On Wed, Feb 12, 2025 at 1:50 PM Rich Shepard > 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

Re: psql command line editing

2025-02-12 Thread Adrian Klaver
On 2/12/25 10:50, Rich Shepard 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? From: https://www.postgres

Re: psql command line editing

2025-02-12 Thread Ron Johnson
On Wed, Feb 12, 2025 at 1:50 PM Rich Shepard 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 P