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.


This worked for me:

set printoptions=header:0,number:y

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.