Results 1 to 3 of 3

Thread: How to set line numbers in vi or vim editor

  1. #1
    Senior Member vijay's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    515

    How to set line numbers in vi or vim editor

    In vi editor, how to set line numbers at the start of each line?

    Example:
    Code:
    > cat file
    abc
    def
    xyz
    
    > vi file
    1 abc
    2 def
    3 xyz
    What command I have to use to set line numbers in vi editor?

  2. #2
    Senior Member vijay's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    515
    In the escape mode, type the following command

    Code:
    :set number

  3. #3
    Senior Member vijay's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    515
    To unset the numbers, use the following command in esc mode

    Code:
    :set nonumber

Similar Threads

  1. Undo all changes in vi or vim editor
    By vijay in forum Unix
    Replies: 1
    Last Post: 05-21-2013, 06:08 AM
  2. Print Line numbers using less command
    By james in forum Unix
    Replies: 1
    Last Post: 06-13-2012, 06:23 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •