Using gvim to print diff?

Is there a way to print the differences as they show when you open them with "gvim -d", with all the common code adding up and only the differences showing up in context? I tried the print menu option, but printed the whole file that I was currently in, instead of printing the folded differences.

+6
vim vimdiff
source share
3 answers

I do not think this is a way to get a parallel listing of two files. But you can use the Vim "Convert to HTML" tool on each of the two files that will be posted, and print them separately. You can then stack them side by side to get the same effect.

Converting to HTML is a kind of "beautiful print" - it saves all the information about visual color / syntax / mix.

:he convert-to-HTML 
+4
source share

I was fortunate enough to use a combination of diff and a2ps:

 $ diff -y --suppress-common-lines oldfile newfile | \ a2ps -l 130 --columns 1 
+3
source share

Firstly, the TOhtml plugin that TOhtml talked about is capable of outputting one HTML code with both the files you have shown (unless you set g:html_diff_one_file to 1). Secondly, if you are not okay with the TOhtml output, you can try my own formatvim (the command to use in this case is :Format diffformat (can be truncated to :Format d )). It has a bit more features in the html output, but the main reason I was worried when writing this down is that you can write your own specification of the output format, all things related to html are stored in one place.

+1
source share

All Articles