VI / Vim Print Line Numbers on Hardcopies / Printer

Posted on in Categories , , last updated April 15, 2013

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?

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.

7 comment

Leave a Comment