Vim Tips Wiki

Print syntax highlighted buffer in one color

Redirected from VimTip284

1,625pages on
this wiki
Add New Page
Talk0 Share

Duplicate tip

This tip is very similar to the following:

These tips need to be merged – see the merge guidelines.

Tip 284 Printable Monobook Previous Next

created July 20, 2002 · complexity basic · author Sean · version 6.0

I use this mapping to print syntax highlighted C++ code in B&W.

This tip needs print_bw.

The mapping is as follows

map <C-p> :color print_bw<CR>:hardcopy<CR>:color sean<CR>:syn on<CR>

Change ":color sean" to whatever is your chosen color scheme.

Need to change line 7 of print_bw from "syntax reset" to "syntax off".

<C-p> on a syntax highlighted buffer turns off syntax highlighting, sets the colors to B&W, prints the buffer, resets the color scheme and turns on syntax highlighting again.


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.