sponsor Vim development Vim logo Vim Book Ad

PrintWithLNum : Prepend line numbers to each line for printing

 script karma  Rating 20/10, Downloaded by 1294  Comments, bugs, improvements  Vim wiki

created by
Colin Keith
 
script type
utility
 
description
In response to a query on the vim mailing list I developed this quick function which prepends the line number to the beginning of each line. The line numbers are left justified and formatted with a 1 character white space on either side of the number.

There are two methods of operation. The first prepends the line numbers to each line and is activated with :Printwln    (or ":Printwln(0)" ). The second method of calling causes the program to prepend the line number and then go on to print the file using ":hardcopy", and then undo the changes it just made. This allows you to print off the contents of a file without changing it.

Hope it helps someone.

Colin.
 
install details
Place where appropriate, source printwln.vim
 

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
printwln.vim 0.1 2002-04-23 6.0 Colin Keith Initial upload
ip used for rating: 18.223.32.230

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
   
Vim at Github