2

I have the following in my ~/.gitconfig:

[core]
pager = less -+$LESS -MR

This makes less to be used for git commands. git commands output contents in less irrespective of the size of the content. After I hit q, the whole content disappears, and I return to my clean bash prompt.

If I remove -+$LESS, it quits when I hit q or if the whole content can fit in one screen after printing it out. That is my bash prompt is not clear, it has previously shown output of the less command.

I can get the above behavior just by removing -+$LESS but I can't do it in normal bash prompt.

How can I get the behavior specified in the paragraph with -+$LESS inside normal bash commands and not only git commands?

3N4N
  • 128

1 Answers1

0

From man less:

-F or --quit-if-one-screen
       Causes less to automatically exit if the entire file can be displayed on the first screen.

Adding -F to the $LESS environment variable should do the trick.

[core]
pager = less -+$LESS -MRF
3N4N
  • 128