Skip to content

feat: Implement enhanced diff highlighting.#70

Merged
sindrets merged 2 commits into
mainfrom
feat/enhanced-diff-hl
Sep 6, 2021
Merged

feat: Implement enhanced diff highlighting.#70
sindrets merged 2 commits into
mainfrom
feat/enhanced-diff-hl

Conversation

@sindrets
Copy link
Copy Markdown
Owner

@sindrets sindrets commented Sep 6, 2021

Resolves #52.

As pointed out by @yorickpeterse, the way vim highlights diffs isn't the most intuitive when you're comparing only two files (vim has to do it this way of course, because it's the only way that makes sense when you're comparing more than two files). When comparing old state on the left with new state on the right, what vim highlights as an addition on the left, actually represents a deletion.

This PR adds a new option enhanced_diff_hl that attempts to tackle this issue. When enabled, a couple new highlighting groups will be generated based on your colorscheme. These will be applied as local winhl in the diff buffers.

enhanced_diff_hl                            *diffview-config-enhanced_diff_hl*
        Type: `boolean`, Default: `false`

        Enable/disable enhanced diff highlighting. When enabled, |hl-DiffAdd|
        in the left diff buffer will be highlighted as |hl-DiffDelete|, and
        the delete fill-chars will be highlighted more subtly.

Before:

2021-09-06-151601_maim

After:

2021-09-06-151538_maim

@sindrets sindrets merged commit 5965e83 into main Sep 6, 2021
@sindrets sindrets deleted the feat/enhanced-diff-hl branch September 6, 2021 21:25
@yorickpeterse
Copy link
Copy Markdown
Contributor

@sindrets Thanks!

yorickpeterse added a commit to yorickpeterse/nvim-grey that referenced this pull request Mar 15, 2023
yorickpeterse added a commit to yorickpeterse/dotfiles that referenced this pull request Mar 16, 2023
Injecting winhl overrides is no longer needed, now that
sindrets/diffview.nvim#70 is merged.
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.

Hooks for tweaking diff highlights

2 participants