DEV Community

loading...

Scratch Diff Using Vim

Jesse Phillips
Senior Quality Assurance (SDET) ¶ Avid hobby D programmer ¶ Telling people what to do because I am right.
・1 min read

First as I have not seen this term utilized let me define what I mean by a "scratch diff." I have chosen this in reference to a "scratch pad." The idea is that you have some text and would like clarity in what is different between them, but you don't need to make a big deal out of the comparison.

Previously I have done this with creating two files and placing the text desired in both of them. Getting the filesystem involved at times just seems like too much for the desired diff. But an internet diff is also not acceptable because at times I need to manipulate the formatting/structure to get a decent comparison.

Well I finally took some time to learn the vim approach to making a scratch diff and isn't too bad.

After opening Vim

:vnew
:diffthis
<ctrl+w><ctrl+w>
:diffthis
Enter fullscreen mode Exit fullscreen mode

Discussion (0)