Vim logo vim online Vim Book Ad

PrintWithLNum : Prepend line numbers to each line for printing

 script karma  Rating 15/8, Downloaded by 271

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 23-Apr-2002 6.0 Colin Keith Initial upload

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 [email protected] after searching the archive. Help Bram help Uganda.
SourceForge Logo