on MacOS, without -X, switching back from the alternate to main buffer clears the screen and thus erases all text that was just printed to the alternate screen buffer.on the version of less MacOS ships with, 487, less will switch to the alternate screen first, before checking if the text is small enough, and thus print the output to the alternate screen buffer.
However, a combination of two things causes this to break: Reading closely, it seems like re-adding -F would fix this.
#MACOS GIT DIFF NOT LESS FULL#
So, even for small commands like git diff, you'll get a full alternate screen. This works for the question at hand, but is suboptimal, as less will always switch to an alternate page regardless of how small the output is. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen. X Disables sending the termcap initialization and deinitialization strings to the terminal. That answer suggests: git config -global core.pager "less -+\$LESS -RS"Ĭauses less to automatically exit if the entire file can be displayed on the first screen. This is an extension to ognockocaten's answer. BSD coreutils), this should not break things.
This will replace the less version MacOS ships with with the latest, but as they are the same utility (unlike GNU coreutils vs. Installing a newer version of less fixes the bug where -F causes small outputs to entirely disapear without -X, and then the config command removes -X, which is what breaks scrolling. Git config -global core.pager "less -+\$LESS -RSF"