[GLLUG] vim line numbering

Reza Beha reza_beha at yahoo.com
Tue Oct 3 14:59:31 EDT 2006


The nl filter works that way.

NAME
     nl - line numbering filter

DESCRIPTION
     The nl command reads lines from the named file, or the stan-
     dard  input if no file is named, and reproduces the lines on
     the standard output.  Lines are  numbered  on  the  left  in
     accordance with the command options in effect.

bash-2.03$ cat fred.c
#include <stdio.h>

int main(void)
{
   int i=0;
   char colors[3][6]={"red","green","blue"};

   for (i=0; i<3; i++) {
   printf("%s \n", colors[i]); }
}

bash-2.03$ nl fred.c
     1  #include <stdio.h>

     2  int main(void)
     3  {
     4     int i=0;
     5     char colors[3][6]={"red","green","blue"};

     6     for (i=0; i<3; i++) {
     7     printf("%s \n", colors[i]); }
     8  }


--- Caleb Cushing <xenoterracide at gmail.com> wrote:

> ok so I figured out how to do line numbering in vim.... but I'm
> wondering if it's possible to skip blank lines when numbers
> 
> example
> 
> 1 hello
> 2 how are you
> 
> 3 I'm fine
> 
> I have to take a keyboarding class this term and the assignments from
> the book have line numbers however if they have you doublespace they
> don't number the line. so it screws up the line numbers. I want to do
> this so I can walk away from the work and come back and know what line
> I'm on.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the linux-user mailing list