From 9657b4346fe29e30a7ae144c59932a92b603ef07 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 19 Aug 2025 10:43:28 +0200 Subject: [PATCH] Remove the git.paging.useConfig option Many people don't understand what this means, which is apparent from the amount of issues that got filed because of this. Let's get rid of it to avoid this confusion. People will have to configure their pager twice if they want to use it both on the command line and in lazygit, which I think is not a big deal. --- docs/Config.md | 3 --- docs/Custom_Pagers.md | 14 +------------- pkg/commands/git_commands/config.go | 6 ------ pkg/config/user_config.go | 3 --- schema/config.json | 5 ----- 5 files changed, 1 insertion(+), 30 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index 079ff5ce9..588f69fc9 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -303,9 +303,6 @@ git: # ydiff -p cat -s --wrap --width={{columnWidth}} pager: "" - # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). - useConfig: false - # e.g. 'difft --color=always' externalDiffCommand: "" diff --git a/docs/Custom_Pagers.md b/docs/Custom_Pagers.md index 915dc70af..bdd695435 100644 --- a/docs/Custom_Pagers.md +++ b/docs/Custom_Pagers.md @@ -10,7 +10,6 @@ Support does not extend to Windows users, because we're making use of a package git: paging: colorArg: always - useConfig: false ``` the `colorArg` key is for whether you want the `--color=always` arg in your `git diff` command. Some pagers want it set to `always`, others want it set to `never`. @@ -54,17 +53,6 @@ git: Be careful with this one, I think the homebrew and pip versions are behind master. I needed to directly download the ydiff script to get the no-pager functionality working. -## Using git config - -```yaml -git: - paging: - colorArg: always - useConfig: true -``` - -If you set `useConfig: true`, lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). - ## Using external diff commands Some diff tools can't work as a simple pager like the ones above do, because they need access to the entire diff, so just post-processing git's diff is not enough for them. The most notable example is probably [difftastic](https://difftastic.wilfred.me.uk). @@ -77,7 +65,7 @@ git: externalDiffCommand: difft --color=always ``` -The `colorArg`, `pager`, and `useConfig` options are not used in this case. +The `colorArg` and `pager` options are not used in this case. You can add whatever extra arguments you prefer for your difftool; for instance diff --git a/pkg/commands/git_commands/config.go b/pkg/commands/git_commands/config.go index 19849b84b..1bed98985 100644 --- a/pkg/commands/git_commands/config.go +++ b/pkg/commands/git_commands/config.go @@ -43,12 +43,6 @@ func (self *ConfigCommands) ConfiguredPager() string { } func (self *ConfigCommands) GetPager(width int) string { - useConfig := self.UserConfig().Git.Paging.UseConfig - if useConfig { - pager := self.ConfiguredPager() - return strings.Split(pager, "| less")[0] - } - templateValues := map[string]string{ "columnWidth": strconv.Itoa(width/2 - 6), } diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index 0fa706bb2..914bf3117 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -316,8 +316,6 @@ type PagingConfig struct { // delta --dark --paging=never // ydiff -p cat -s --wrap --width={{columnWidth}} Pager PagerType `yaml:"pager"` - // If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). - UseConfig bool `yaml:"useConfig"` // e.g. 'difft --color=always' ExternalDiffCommand string `yaml:"externalDiffCommand"` } @@ -797,7 +795,6 @@ func GetDefaultConfig() *UserConfig { Paging: PagingConfig{ ColorArg: "always", Pager: "", - UseConfig: false, ExternalDiffCommand: "", }, Commit: CommitConfig{ diff --git a/schema/config.json b/schema/config.json index db9c79638..ebf59e98b 100644 --- a/schema/config.json +++ b/schema/config.json @@ -1672,11 +1672,6 @@ "ydiff -p cat -s --wrap --width={{columnWidth}}" ] }, - "useConfig": { - "type": "boolean", - "description": "If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager).", - "default": false - }, "externalDiffCommand": { "type": "string", "description": "e.g. 'difft --color=always'"