I would like to be able to print in other than Courier font using the :ha command.

Investigating more closely, I found that it is documented that the Courier font is always used:

- 'printfont' - The font name is ignored (the Courier family is always used -
  it should be available on all PostScript printers) but the font size is

— From :help postscript-printing

However, there must be some workaround, perhaps using an external tool.

I would like to keep my Vim syntax highlighting in the printout, which rules out just opening the file in TextEdit (or TextWrangler) for printing.

I'm using MacVim snapshot 73, which is Vim 7.4.258.

How can I print a file to PDF using Vim's syntax highlighting but an alternate font?


Instead of printing from Vim, you could instead generate an HTML file using :TOhtml. Then you can use CSS to set the font used for the HTML and print that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.