44

I just switched to Oh My Zsh and I'm using the Avit theme.

When I type git log --oneline my output seems to be piped to less. It does this for whatever theme I use.

When I used bash shell, it never cleared the screen to output those lines.

How do I set it up so that it doesn’t clear the screen to output lines but instead just output the lines after I type the command?

Here's a screenshot for reference:

enter image description here

Paul
  • 543

5 Answers5

46

oh-my-zsh runs less command with -R (repaint). You can disable this behavior by adding the following line at the end of your ~/.zshrc

unset LESS;

This is set to -R in ~/.oh-my-zsh/lib/misc.zsh

Source: https://stackoverflow.com/a/49267711/1050554.

Luxian
  • 561
  • 1
  • 4
  • 4
25

maybe a better solution :

git config --global --replace-all core.pager "less -F -X"

from How do I prevent git diff from using a pager?

zqb-all
  • 371
14

You can define a pager, which git uses by default for its output via

  1. the $GIT_PAGER or $PAGER environment variable
  2. the git config entry core.pager

The pager can be temporary disabled with the git command line option --no-pager. How to make it permanent depends upon the both possibilities above:

  1. find, where in your shell's config files the $GIT_PAGER or $PAGER environment variable gets defined and remove that line.

  2. run git config --global core.pager ''

mpy
  • 28,816
5

A simple way to fix this is to make git log not use the pager in the global configuration settings:

git config --global pager.log false

2

Edit file ~/.zshrc and add

PAGER=

Then, save the file and execute source ~/.zshrc.

alper
  • 200