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 diff instead of splits (side-by-side)? #1957

Closed
simondrake opened this issue Mar 12, 2022 · 4 comments
Closed

Inline diff instead of splits (side-by-side)? #1957

simondrake opened this issue Mar 12, 2022 · 4 comments

Comments

@simondrake
Copy link

I've been using this plug-in for a long time and it's excellent, thank you for putting in the effort to make it.

This isn't an issue, more a question, so if there's a more suitable place for it please let me know.

Whenever I use GitHub/GitLab to review code, I use the inline diff option as opposed to the side-by-side one because I prefer how it looks.

I am exploring using vim for larger MRs, for all the reasons I enjoy coding in it, but I can't figure out how to get the diff to show inline instead of in a split.

Is there a way to have vim-fugitive open diffs in an inline view, instead of a side-by-side view(Gvdiffsplit)?

For reference, I usually use a git review alias which I've included below

[alias]
    files = !git diff --name-only $(git merge-base HEAD \"$REVIEW_BASE\")
    stat = !git --no-pager diff --stat $(git merge-base HEAD \"$REVIEW_BASE\")
    review = !nvim -p $(git files) +\"tabdo Gvdiffsplit! $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
    reviewone = !nvim -p +\"tabdo Gvdiffsplit! $REVIEW_BASE\" +\"let g:gitgutter_diff_base = '$REVIEW_BASE'\"
@tpope
Copy link
Owner

tpope commented Mar 13, 2022

If by "inline" you mean a unified diff, it sounds like the heart of what you're looking for is :Git diff $REVIEW_BASE...

@tpope tpope closed this as completed Mar 13, 2022
@simondrake
Copy link
Author

Thanks for the reply @tpope, but that's not quite what I was looking for.

If I take one of my side-projects as an example and make some random changes. Running Gdiffsplit gives me the following view, from which I can do vim operations such as running a go to definition operation on *Manager to see where that's defined.

image

2022-03-14.11-51-22.mp4

If I use :Git diff, it just opens view akin to if I ran that outside of vim where I can't use the power of vim (e.g. go to definition)

2022-03-14.11-54-46.mp4

What I was asking about, is if it's possible to have the format/utility of Gdiffsplit, just as a unified/inline diff instead of split.

@tpope
Copy link
Owner

tpope commented Mar 14, 2022

No, Vim doesn't support that.

@simondrake
Copy link
Author

Thanks for looking into it, nevertheless.

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

2 participants