LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-28-2012, 06:42 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit LOL), USA
Distribution: Centos 6.7 Under VMware in Win7
Posts: 436

Rep: Reputation: 33
Showing Line Numbers in the VI Editor


Greetings.

I would like to have line numbers showing when I use the VI editor.

Can anyone advise how to do this.

I'm a newbie that's why I'm asking here.

Thanks
 
Old 08-28-2012, 06:44 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
http://www.cyberciti.biz/faq/vi-show-line-numbers/
 
Old 08-28-2012, 06:52 PM   #3
Renante
LQ Newbie
 
Registered: Aug 2012
Location: Ottawa ON, Canada
Distribution: Red Hat Enterprise Linux 6.3 Server
Posts: 13

Rep: Reputation: 2
Quote:
Originally Posted by swamprat View Post
Greetings.

I would like to have line numbers showing when I use the VI editor.

Can anyone advise how to do this.

I'm a newbie that's why I'm asking here.

Thanks
on vi command, type: set number

To make that permanent, edit your ~/.vimrc -- vi ~/.vimrc

If you plan to use vi in programming (C, C++, ...):
syntax on
set number
set cindent
set expandtab
set tabstop=2
set shiftwidth=2
set softtabstop=2
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Trying to number every other line and append those numbers to end of line kmkocot Programming 7 04-23-2010 12:17 PM
Grep's line numbers parsed into one line of output. judgex Programming 8 08-14-2006 05:22 AM
Prepend # for certain line numbers in VI twantrd Linux - Software 3 09-05-2005 02:27 PM
printing line numbers? fisheromen1031 Programming 1 07-27-2004 03:19 PM
line numbers in kdevelop febisfebi Programming 1 02-18-2004 08:45 PM


All times are GMT -5. The time now is 02:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration