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

Switch from a unified diff into a split diff #2219

Closed
idbrii opened this issue Sep 28, 2023 · 1 comment
Closed

Switch from a unified diff into a split diff #2219

idbrii opened this issue Sep 28, 2023 · 1 comment

Comments

@idbrii
Copy link
Contributor

idbrii commented Sep 28, 2023

When I'm browsing commits, how can I switch from a unified diff (opening the commit in a buffer) to a split diff (Gdiffsplit)?

Since a commit can span multiple files, it'd have to act on the file owning the diff hunks under the cursor.

I can CR on a + line to open the file after the change and :Gdiffsplit !^ to start the diff. Not sure how to do that on - lines.

One of my first guesses was to call :Gdiffsplit in the buffer, but that has no effect.

@idbrii
Copy link
Contributor Author

idbrii commented Sep 28, 2023

I figured out that the line containing the diff command is a special kind of fugitive-object:

diff --git a/data/scripts/file.lua b/data/scripts/file.lua

You can CR or most of the other :help fugitive-navigation-maps keys on that line to open a split diff.

I don't think this is anywhere in the help, so I'll open a PR to add.

@idbrii idbrii closed this as completed Sep 28, 2023
idbrii added a commit to idbrii/vim-fugitive that referenced this issue Sep 28, 2023
References tpope#2219.

There's awesome special behaviour for buffers with diff output to view
it in a split diff instead of unified diff.
idbrii added a commit to idbrii/vim-fugitive that referenced this issue Jun 27, 2024
References tpope#2219.

There's awesome special behaviour for buffers with diff output to view
it in a split diff instead of unified diff.
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

No branches or pull requests

1 participant