When I print from vim
using :ha
, everything is great, except yellow is freakishly bright. How to tell vim
to darken the yellow when printing with :ha
?
:colorscheme
when printing with syntax:y
(conversely: print with syntax:n
- sehe 2012-04-05 22:44
I got the answer from some great guy in IRC at freenode.net. (rking if someone knows him :)
Anyway, this solution works perfectly for me. By pressing F12, it opens file I was editing in vim in browser (in the case below in chrome), and all I have to do is right click > print.
Anyway here's the code you should add to your ~/.vimrc
file:
:map <f12> :TOhtml<cr>:%s/#ffff00/#aaaa00/g<cr>:w<cr>:!chromium-browser --print file://`pwd`/%<cr>:!rm %<cr>:q<cr>
Notice that you can specify the shade of the color you wish to change (in this case yellow) and modify it. It even gets rid of the duplicate file created by the :w command. Also, this code is modified for Ubuntu, with other OSs it might need some modification.
There is only one bug > !chromium-browser --print
should print it automatically but it doesn't. I need to manually print it from the browser. Minor nuance, but if someone can solve this up, I would greatly appreciate :)
If you are looking for a way to just print readable code, you might just
:set printoptions-=syntax:y
:set printoptions+=syntax:n
before you do
:hardcopy
Otherwise, you might choose a colorscheme without yellow(ish) colors before printing