Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline diffs #899

Open
caenrique opened this issue Oct 4, 2023 · 5 comments
Open

Inline diffs #899

caenrique opened this issue Oct 4, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@caenrique
Copy link

Describe the solution you'd like
Same as preview_hunk_inline but for the whole file

Describe alternatives you've considered

  • Using normal diff view in a split
  • Using plugins for diffs like DiffView.nvim
  • viewing diffs inline a hunk at a time

I think the inline diff for hunks is awesome and I would love to be able to do it for the whole file in a single toggle

@caenrique caenrique added the enhancement New feature or request label Oct 4, 2023
@wh75er
Copy link

wh75er commented Dec 20, 2023

Is this not possible in the current implementation? I'm trying to find the way how to do it, but seems it's not possible :(

UPD.
I found this issue in vim-fugitive repo. Contributor of this repository says that it's not possible
tpope/vim-fugitive#1957

@lewis6991
Copy link
Owner

It doesn't support it built in, but plugins are able to implement it.

Gitsigns already supports viewing a diff inline for a single hunk, that just needs to be extended for the whole buffer.

@lewis6991
Copy link
Owner

Just looked into this and it's more complicated than I anticipated.

Basically, In order to achieve syntax highlighting for deleted hunks, Gitsigns creates some blank virtual_lines and then places a floating window on top. Since this floating window is removed when the cursor is moved, we currently don't have to worry about it going off screen, or generally have to manage it much.

One possible solution would be to re-implement this without the floating window and grab all the highlights manually.

@dudicoco
Copy link

dudicoco commented Apr 5, 2024

Isn't this already supported?

Just create a binding that toggles the following commands:

toggle_deleted
toggle_linehl
toggle_word_diff

@lewis6991
Copy link
Owner

That's one way of achieving this. However toggle_deleted doesn't show syntax highlighting unlike preview_hunk_inline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants