My scenario is the following: When I ask the psql program for \help, it pipes its output to less. Sometimes, I would like to keep the help contents while writing my next query. I imagine this could happen if I could tell less to write to stdout, like more would do, while in interactive mode.
Restrictions:
I will decide whether or not this should happen AFTER I have seen the contents of \help. So, customizing the pager used by psql is (I think) not an option. This means that my question is not a duplicate of:
https://stackoverflow.com/questions/14474138/customize-pager-in-psql
or:
Making less print to stdout if an entire file can be displayed on one screen
What I am currently using:
\setenv PAGER more OR \setenv PAGER 'less -X'
\help alter user
q (to exit less or more)
-- Now I can write my query while looking at the alter user syntax above
What is lacking in this approach is that I would like to choose whether I want the -X option or not AFTER I have looked at the contents. I can imagine that less can achieve that by writing to both the main and the alternate buffer.
|
command in theless(1)
manpage. For instance, if you type|<Enter>cat<Enter>
, you will have the current content left on the screen after you exit or suspendless
. Checklesskey(1)
if you want to do that with a single key. – Jun 26 '21 at 19:13