Note that there are some explanatory texts on larger screens.

plurals
  1. POpipe to less -S without clearing the output from the command line history
    primarykey
    data
    text
    <p>so I want to alow horizontal scrolling in the terminal for my custom bash command by piping the output of the command to <code>| less -S</code></p> <p>However, if I do this, once you exit less, the output of the command will not stay in the command line history</p> <p>Is there a way to configure less to keep the output of the command in the history when you exit less?</p> <p>Eg. if you look at <code>git diff</code>, you can perform horizontal scrolling and then exit but the output still stays in the history in which you can then type new commands...I essentially want to emulate this for my custom bash command. Also in <code>git diff</code> it performs horizontal scrolling on the spot (ie. without using a new screen) and the command line history is still visible whereas for <code>less</code> it would do it in its own screen and you won't be able to see the command line history while "lessing". Would it be possible to emulate this git diff-like mechanism in less as well? </p> <p>If there's any other solution without using <code>less</code> feel free to throw it out there</p> <h2>UPDATED QUESTION</h2> <p>So suppose I do this:</p> <pre><code>cat loremipsum | less -FRSX Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sed </code></pre> <p>And then I press right twice so that it scroll to the right twice. And then I press q to exit less. The output that remains on the screen will then be:</p> <pre><code>cat loremipsum | less -FRSX Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam sed ESCOC dictum diam. Nullam quis urna ullamcorper, accumsan quam vitae, aliquet ESCOD nisl. Maecenas vitae lorem orci. Ut vel est erat. Cras quis sagittis sapien, ac volutpat metus. username@server:~/httpdocs$ </code></pre> <p>However in git diff when you do the same and then press q, only the last part (ie the last part of the screen where I scrolled to the right)</p> <pre><code> git diff nisl. Maecenas vitae lorem orci. Ut vel est erat. Cras quis sagittis sapien, ac volutpat metus. username@server:~/httpdocs$ </code></pre> <p>Will remain on the screen </p> <p>How do I get this to happen as well</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload