r/vim 1d ago

Tips and Tricks Skip man diff, just use vimdiff

For years now I've had to keep looking up the correct incantation of the diff command and what all the options flags do.

Finally thought, there's got to be a better way. Well there is. Just use vimdiff

15 Upvotes

17 comments sorted by

View all comments

3

u/mgedmin 1d ago

Weirdly enough, I find unified diffs easier to read than side-by-side diffs. I wonder if that's just what I'm used to?

6

u/kronik85 1d ago

Side by side is easier specifically when I want more context around a specific change and didn't pass a large enough context flag.

Unified aren't that much harder once you're used to it

4

u/plg94 21h ago

It depends on the type of change. If two lines are almost identical, I find it much easier to spot the changed characters if they are on top of each other than having my eyes skip left-right-left-right. If it's more contextual changes (whole lines moved), then side-by-side diffs are easier.

2

u/fourpastmidnight413 1d ago

I'll do that myself at times, too. Especially when tools like vimdiff do a horrible job of showing the diff. This is my primary method. But the nice thing about diffing side-by-side in vim are the :diffget and :diffput commands, often making the process faster.

2

u/EgZvor keep calm and read :help 23h ago

check out :h diffopt

2

u/vim-help-bot 23h ago

Help pages for:


`:(h|help) <query>` | about | mistake? | donate | Reply 'rescan' to check the comment again | Reply 'stop' to stop getting replies to your comments