Say I am in a directory with the filetree below, where
gold.txt is a file I would like to compare each of the other .txt files against, one at a time.
. ├── gold.txt └── to-compare ├── compare1.txt ├── compare2.txt ├── compare3.txt ├── ... ...
Currently my idea of the workflow would be:
- I open (n)vim in diff mode with
nvim -d to-compare/compare1.txt gold.txt, and open up a netrw split with
:Lexplore, so I can easily swap out other files to compare to gold.txt.
- I see the difference between compare1 and gold as in the image below. Nice.
- I switch to compare2.txt in the middle window by selecting it in netrw and pressing enter
- Now, to see the difference between compare2 and gold, I need to do
diffthison both of the windows.
- To compare compare3 with gold, I have to do this again.
I'd really like to just be able to quickly tap through the list of files in
to-compare/, quickly seeing how & where each one differs with
gold.txt, without having to type diffoff and diffthis a bunch of times.
That is, I'd like to put my cursor in the leftmost split in the image below, and whenever I select the next file I'd like to compare (or by selecting it and typing enter, or p for preview or whatever), I'd like see the diff with the other file that's open.
I'm sure there are many options for how to do this. I'm not wed to netrw or anything else about this workflow. Is there an easy way to do what I want to do?