Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 962 Bytes

set-a-custom-pager-for-a-specific-command.md

File metadata and controls

31 lines (23 loc) · 962 Bytes

Set A Custom Pager For A Specific Command

The pager can be configured globally, for one run of a command, or as I'll explain in this post, for a specific command.

I explore all of this in Optimize the way Git displays the output of commands.

Let's assume a git configuration that uses less for any command that need a pager. Perhaps you'd like for the git show to work a bit differently than other commands. You want it to use less with the -F and -X flags.

A custom pager command can be set for any command in the [pager] section of the ~/.gitconfig file.

[pager]
  show = "less -FX"

If you want to turn off the pager for a specific command, set it to the boolean value false instead.

[pager]
  show = false

See man git-config for more details in the core.pager and pager.<cmd> sections.