VI / Vim Print Line Numbers on Hardcopies / Printer

by on April 12, 2008 · 6 comments· LAST UPDATED April 15, 2013

in , ,

How do I print line numbers on the printer for my c / java / c++ code written using vi or vim text editor under Linux / UNIX like operating system?

Tutorial details
DifficultyEasy (rss)
Root privilegesNo
Requirementsvi/vim
Estimated completion timeN/A
To print line number on screen and hardcopies such as printer type the following two commands while vim / vi text editor is open:

set number
set printoptions=number:y

Make sure you add above two commands to your ~/.vimrc file; so that settings get loaded everytime you start the vim text editor.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 6 comments… read them below or add one }

1 Giorgis May 31, 2008 at 11:38 am

Great tip, thanks guys (and google)

Reply

2 R March 4, 2009 at 12:03 am

Awesome!

Reply

3 venkatakumar November 12, 2009 at 1:45 pm

What is great tip , it working good.

Reply

4 venkatakumar November 12, 2009 at 1:45 pm

what a great tip, it’s working…

Reply

5 waleking May 27, 2012 at 6:19 am

Thanks for your tip, it works very well!

Reply

6 Philippe Petrinko April 15, 2013 at 1:28 pm

Good to remember, thanks Vivek.
– Philippe

Reply

Leave a Comment

Tagged as: , , , , , , , , , ,

Previous Faq:

Next Faq: