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.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

7 comment

Leave a Comment