Skip to content

Comments

fix: override delta side-by-side via --config#76

Draft
pablospe wants to merge 1 commit intodlvhdr:mainfrom
pablospe:sbs-DELTA_FEATURES
Draft

fix: override delta side-by-side via --config#76
pablospe wants to merge 1 commit intodlvhdr:mainfrom
pablospe:sbs-DELTA_FEATURES

Conversation

@pablospe
Copy link
Contributor

@pablospe pablospe commented Feb 1, 2026

Summary

  • Delta's --side-by-side flag can only enable side-by-side mode — there's no --no-side-by-side to disable it. So when the user's gitconfig has side-by-side = true, diffnav couldn't turn it off on toggle.
  • Use a temporary gitconfig with delta --config that includes the user's config but overrides side-by-side to the desired value.
  • Clear diff cache on toggle so delta re-renders with the new mode.

Delta's --side-by-side flag can only enable side-by-side mode but
cannot disable it when the user's gitconfig has side-by-side = true.
Use a temporary gitconfig with --config that includes the user's
config and overrides the side-by-side setting. Also clear the diff
cache on toggle so delta re-renders with the new mode.
@pablospe
Copy link
Contributor Author

pablospe commented Feb 1, 2026

I use as my default: side-by-side = true but it can't be disable that easily.

This is related to these issues:

@pablospe pablospe marked this pull request as draft February 1, 2026 11:35
// SetSideBySide updates the diff view mode and re-renders.
func (m *Model) SetSideBySide(sideBySide bool) tea.Cmd {
m.sideBySide = sideBySide
m.cache = make(nodeCache)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be rebased with your latest changes that use the cache key per mode

if err != nil {
return "", err
}
gitconfig := filepath.Join(home, ".gitconfig")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm there are cases where this won't work.
For example, my git config sits under $XDG_CONFIG_HOME/git/config which resolves to ~/.config/git/config.
I think a more bullet proof approach would be to follow https://git-scm.com/docs/git-config#FILES.

Another approach would be to call git config --list --show-origin and look for a line relating side-by-side by delta.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, not sure about this PR, this is more a problem of delta (actually clap). I tried to solve it adding --no-* flag in delta itself:
dandavison/delta#2095

Another approach would be to call git config --list --show-origin and look for a line relating side-by-side by delta

sorry, I am not sure exactly what you mean here. Could you expand on it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, not sure about this PR, this is more a problem of delta (actually clap). I tried to solve it adding --no-* flag in delta itself: dandavison/delta#2095

Oh that's nice! Let's see how it goes.

sorry, I am not sure exactly what you mean here. Could you expand on it?

In order to understand where the git config file is, you can call git config --list --show-origin. For me its output is something like:

...
file:/Users/dlvhdr/.config/git/config   delta.syntax-theme=tokyonight_night
file:/Users/dlvhdr/.config/git/config   delta.dark=true
file:/Users/dlvhdr/.config/git/config   delta.tabs=2
file:/Users/dlvhdr/.config/git/config   delta.file-style=omit
file:/Users/dlvhdr/.config/git/config   delta.file-decoration-style=none
file:/Users/dlvhdr/.config/git/config   delta.line-numbers=true
...

You can then take the file path from the 1st column.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants