:hardcopy a file in vim with full colorscheme

落爺英雄遲暮 提交于 2019-12-04 13:59:05

问题


I'd like to print some files I edited in MacVIM using full color, including the dark background.

Of course I won't send it to printer, I just want to save it in PDF.

:hardcopy removes the background and applies an ugly scheme.

Is it possible?


回答1:


Quoting from :help :hardcopy

The current highlighting colors are used in the printout, with the following considerations:

1) The normal background is always rendered as white (i.e. blank paper).

2) White text or the default foreground is rendered as black, so that it shows up!

3) If 'background' is "dark", then the colours are darkened to compensate for the fact that otherwise they would be too bright to show up clearly on white paper.

So it would appear the answer is, no you can't from :hardcopy.

It also gives this note:

Note: If you have problems printing with :hardcopy, an alternative is to use :TOhtml and print the resulting html file from a browser.

If that's an option, that's going to be the easiest way to do it.




回答2:


Rather use :TOhtml (this is a plugin that is usually included in the default Vim runtimes): type Q to enter Ex mode, and then:

let html_number_lines=1
let html_no_pre=0
TOhtml
w
visual


来源:https://stackoverflow.com/questions/8557501/hardcopy-a-file-in-vim-with-full-colorscheme

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!