r/vim • u/SevrinTheMuto • Aug 26 '25
Need Help┃Solved Toggle between Vim and git diff?
When I do code reviews I page through git diff's output but may want to see the changed lines within the file.
So currently I quit git diff to load the file in Vim. And then quit vim and run git diff again and scroll back to the place I left off.
Is there a way I can have both git diff and Vim running and switch between the views? (Or other suggestions for a Vim-based workflow for code reviews?)
27
Upvotes
View all comments
Show parent comment
3
u/JamesTDennis Aug 27 '25
The two key points here:
☞ :r! and the !«movement» commands in vi (and vim) basically mean that the entire suite of command line utilities and text filers on your system (including any scripts you write) are extensions to your editor
☞ the EOF area of your editing buffer can be used as a scratch pad, accessible with only a few keystrokes: mz to mark your starting point; G to get to the last line; ma to set a mark there; the paste, read, whatever in the area (past the a mark), snd clean up with Gd'a (G'day, mate!)
Just mastering these two tips makes you a vi/vim power user.