Technology TidBits

Answers to various technical questions on php programming, mysql, linux, and many more categories.



How can I turn on line numbering in Vi?

Last updated: 07/02/2009
Add comment
Votes: 0
Comments: 0
Sometimes it is useful to view line numbers when editing a file, and especially when coding.  To turn on this numbering in the vi editor, type this:

:set number
(enter)

You should see something like this in your editor:


      1 .text {
      2         font-family: Arial, Helvetica, sans-serif;
      3         font-size: 12px;
      4 }
      5 .green_text {
      6         font-family: Arial, Helvetica, sans-serif;
      7         font-size: 12px;
      8         font-weight: bold;
      9         color: green;
     10 }
     11 h3 {
     12         font-family: Arial, Helvetica, sans-serif;
     13         font-size: 16px;
     14 }


To turn off the numbering, simply type:

:set nonumber

(enter)

Other questions in this category:
How do I set Tab stops in VI?
How can I jump to a line in the vi editor?
How can I remove DOS linebreaks (^M) from my files?
How can I remove leading whitespace in all lines in a file using vi?
How can I delete a large chunk of text using vi?
How can I undo and redo changes in vi?
How can I search in the vi editor?



Powered by KnowledgebasePublisher 1.1
Superb Internet
Content provided by Roberts WebForge, Inc.