How can I view git diff for any commit using vim-fugitive?
Diff between current file and the index :Gdiff :0 Diff between current file and some other [revision] :Gdiff [revision] Diff between current file and current file 3 commits ago: :Gdiff ~3
Diff between current file and the index :Gdiff :0 Diff between current file and some other [revision] :Gdiff [revision] Diff between current file and current file 3 commits ago: :Gdiff ~3
:qa quits all open windows/buffers/splits/tabs (aliases: :qall :quitall) Vim documentation for :qa For help on this command in Vim: :help :qa :qa! will quit without giving an option to save if it’s modified. :wqa will write all changed buffers and then quit. :wqa! will write all changed buffers, even readonly ones, and then quit.
The following command will change a vertical split into a horizontal split: ctrl+w then J To change back to a vertical split use either: ctrl+w H or ctrl+w L For more information about moving windows: :h window-moving :h ctrl-w_J :h ctrl-w_K :h ctrl-w_H :h ctrl-w_L
You can execute windo set nodiff noscrollbind and then close the second window. Update: there is a diffoff command. Use windo diffoff, not what I wrote in previous line.
This implements what you want (taken from the diffexpr docs with -b changed to -w): set diffopt+=iwhite set diffexpr=DiffW() function DiffW() let opt = “” if &diffopt =~ “icase” let opt = opt . “-i ” endif if &diffopt =~ “iwhite” let opt = opt . “-w ” ” swapped vim’s -b with -w endif … Read more
Displaying 10 files side-by-side and highlighting differences can be easily done with Diffuse. Simply specify all files on the command line like this: diffuse 1.txt 2.txt 3.txt 4.txt 5.txt 6.txt 7.txt 8.txt 9.txt 10.txt
To begin diffing on all visible windows: :windo diffthis which executes :diffthis on each window. To end diff mode: :diffoff! (The ! makes diffoff apply to all windows of the current tab – it’d be nice if diffthis had the same feature, but it doesn’t.)
I suggest opening the second file in the same tab instead of a new one. Here’s what I usually do: :edit file1 :diffthis :vnew :edit file2 :diffthis The :vnew command splits the current view vertically so you can open the second file there. The :diffthis (or short: :difft) command is then applied to each view.
I don’t know why vim uses so many colors to highlight with, it doesn’t really help you figure out what’s going on. I modified my colorscheme to only use one color to highlight (with another to show where theres a difference within a line) and it made all the difference. Before After I did this … Read more
git config –global diff.tool vimdiff git config –global difftool.prompt false Typing git difftool yields the expected behavior. Navigation commands, :qa in vim cycles to the next file in the changeset without saving anything. Aliasing (example) git config –global alias.d difftool .. will let you type git d to invoke vimdiff. Advanced use-cases, By default, git … Read more