vim – Vim printoptions Won’t Accept Two Options Simultaneously

printingvimvimrc

I want to print my code into a pdf file, and I found this answer very helpful. However, I want the generated pdf without header and with line number.

From the comment and internet, I found I need to add: set printoptions=header:0 and set printoptions=number:y in .vimrc, but this two command can take effect when I only add one of them.

When I add two of them, only the last added take effect, for example, when I wirte:

set printoptions=number:y                                    
set printoptions=header:0     

The header is removed but there are no line numbers.

Best Answer

This worked for me:

set printoptions=header:0,number:y