Sunday, August 11, 2013

Vim : Actually numbering the lines

You can always display line numbers inside vim with :set nu , little did I know of a way of actually inserting the line number inside the file .

Here is a cool trick for line numbering

  • Number all the lines in Vim

    • :%! cat -n 

  • Number only a portion of file contents
    • First enter the Vim visual mode by pressing v
    • select the portion that you want to number
    • then :'<,'>!cat -n





No comments:

Post a Comment