One thing I don’t like about
Combining all these together, I have added this to my
gitis that commands like
git diffdon’t clear screen when they exit. If I view a file using
less, e.g. by running
lesswould clear the file content from the screen when it exits. But
git log, etc. don’t. With some Googling around, I found that:
gituses the default pager the user has configured. On Ubuntu machines it’s
$PAGERis not defined.
- You can configure less by defining
$LESSvariable with the flags you want to pass by default.
- Nigel McNie has posted a set of flags that are a good default flags for
lesstells it to not clear the screen when it exits. From a related question on Super User I found that passing the flag
lessto always clear the screen when it exits.
~/.zshrc, and everything is just the way I want.
While adding this line made
export LESS="-+X -FR"
gitwork fine, it resulted in
lessbehaving erratically. Now I have the following config in my
~/.gitconfig, and things seem to be good.
[core] pager = less -+X -+F