psql readline Tab insert tab

Started by Hans Ginzelover 10 years ago7 messages
#1Hans Ginzel
Hans@matfyz.cz

Hello,

how to make psql (readline) to insert tab when Tab is pressed? E.g. for
pasting. I know, there is -n option. But then the history is not
accessible.

I have tried
$if psql
Control-I: "\t"
Control-A: complete
$endif
in my ~/.inputrc. But when I press Tab psql freezes until I press Ctrl+C.

Regards
HG

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

#2Albe Laurenz
laurenz.albe@wien.gv.at
In reply to: Hans Ginzel (#1)
Re: psql readline Tab insert tab

Hans Ginzel wrote:

how to make psql (readline) to insert tab when Tab is pressed? E.g. for
pasting. I know, there is -n option. But then the history is not
accessible.

I have tried
$if psql
Control-I: "\t"
Control-A: complete
$endif
in my ~/.inputrc. But when I press Tab psql freezes until I press Ctrl+C.

Probably an endless loop.

It could be done by adding the following lines to your ~/.inputrc file:

$if Psql
TAB: tab-insert
$endif

Yours,
Laurenz Albe

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

#3Hans Ginzel
Hans@matfyz.cz
In reply to: Albe Laurenz (#2)
Re: psql readline Tab insert tab

Hans Ginzel wrote:

how to make psql (readline) to insert tab when Tab is pressed? E.g. for
pasting. I know, there is -n option. But then the history is not
accessible.

I have tried
$if psql
Control-I: "\t"
Control-A: complete
$endif
in my ~/.inputrc. But when I press Tab psql freezes until I press
Ctrl+C.

Probably an endless loop.

It could be done by adding the following lines to your ~/.inputrc file:

$if Psql
TAB: tab-insert
$endif

Great! Thank you very much. Could this be added as note to the -n option
of the page http://www.postgresql.org/docs/current/static/app-psql.html,
please?

Regards
Hans

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

#4Hans Ginzel
hans@matfyz.cz
In reply to: Hans Ginzel (#3)
Re: psql readline Tab insert tab

Dne 29.05.2015 13:18, Hans Ginzel napsal:

Hans Ginzel wrote:

how to make psql (readline) to insert tab when Tab is pressed?

E.g. for pasting. I know, there is -n option. But then the history is
not accessible. I have tried $if psql Control-I: "t" Control-A: complete
$endif in my ~/.inputrc. But when I press Tab psql freezes until I press
Ctrl+C.

Probably an endless loop. It could be done by adding the

following lines to your ~/.inputrc file: $if Psql TAB: tab-insert
$endif

Great! Thank you very much. Could this be added as note to

the -n option

of the page

http://www.postgresql.org/docs/current/static/app-psql.html,

please?

And/or could there be added an option pset paste like :set

paste/nopaste in Vim, please?

http://vimdoc.sourceforge.net/htmldoc/options.html#%27paste%27

Regards

Show quoted text

Hans

#5Albe Laurenz
laurenz.albe@wien.gv.at
In reply to: Hans Ginzel (#4)
1 attachment(s)
Re: [NOVICE] psql readline Tab insert tab

Hans Ginzel wrote:

how to make psql (readline) to insert tab when Tab is pressed? E.g. for
pasting. I know, there is -n option. But then the history is not
accessible.

It could be done by adding the following lines to your ~/.inputrc file:

$if Psql
TAB: tab-insert
$endif

Great! Thank you very much. Could this be added as note to the -n option
of the page http://www.postgresql.org/docs/current/static/app-psql.html,
please?

Would that be worth an addition to the documentation?

Yours,
Laurenz Albe

Attachments:

0001-Document-how-to-disable-tab-completion-with-readline.patchapplication/octet-stream; name=0001-Document-how-to-disable-tab-completion-with-readline.patchDownload
From 174ba48711a20867a60105ac3db065993187c5f4 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.albe@wien.gv.at>
Date: Mon, 1 Jun 2015 12:40:01 +0200
Subject: [PATCH] Document how to disable tab completion with readline.

---
 doc/src/sgml/ref/psql-ref.sgml |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml
index 62a3b21..45a0da6 100644
--- a/doc/src/sgml/ref/psql-ref.sgml
+++ b/doc/src/sgml/ref/psql-ref.sgml
@@ -280,6 +280,15 @@ EOF
        not use the command history.
        This can be useful to turn off tab expansion when cutting and pasting.
       </para>
+      <para>
+       To retain <application>Readline</application> support and only disable
+       tab expansion, you could instead add this to <filename>.inputrc</filename>:
+<programlisting>
+$if Psql
+TAB: tab-insert
+$endif
+</programlisting>
+      </para>
       </listitem>
     </varlistentry>
 
-- 
1.7.1

#6Peter Eisentraut
peter_e@gmx.net
In reply to: Albe Laurenz (#5)
Re: [NOVICE] psql readline Tab insert tab

On 6/1/15 7:00 AM, Albe Laurenz wrote:

Hans Ginzel wrote:

how to make psql (readline) to insert tab when Tab is pressed? E.g. for
pasting. I know, there is -n option. But then the history is not
accessible.

It could be done by adding the following lines to your ~/.inputrc file:

$if Psql
TAB: tab-insert
$endif

Great! Thank you very much. Could this be added as note to the -n option
of the page http://www.postgresql.org/docs/current/static/app-psql.html,
please?

Would that be worth an addition to the documentation?

There is already a section about this on the psql man page. (Look for
"disable-completion".)

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#7Albe Laurenz
laurenz.albe@wien.gv.at
In reply to: Peter Eisentraut (#6)
Re: [NOVICE] psql readline Tab insert tab

Peter Eisentraut wrote:

On 6/1/15 7:00 AM, Albe Laurenz wrote:

Hans Ginzel wrote:

how to make psql (readline) to insert tab when Tab is pressed? E.g. for
pasting. I know, there is -n option. But then the history is not
accessible.

It could be done by adding the following lines to your ~/.inputrc file:

$if Psql
TAB: tab-insert
$endif

Great! Thank you very much. Could this be added as note to the -n option
of the page http://www.postgresql.org/docs/current/static/app-psql.html,
please?

Would that be worth an addition to the documentation?

There is already a section about this on the psql man page. (Look for
"disable-completion".)

Right, I didn't notice that.

Yours,
Laurenz Albe

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers