LinuxQuestions.org
Help answer threads with 0 replies.
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 01-18-2008, 03:53 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
Question Setting numbers on in VI


I would like to have the numbers set on when ever I us VI to either create or edit a file.

I was told to create a file called .exrc in my home directory which I did. I included the single command set number.

Still doesn't work.

Any help will be much appreciated.

Thanks.
 
Old 01-18-2008, 04:51 PM   #2
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Willoughby, Ohio
Distribution: linuxdebian
Posts: 7,232
Blog Entries: 5

Rep: Reputation: 190Reputation: 190
try setting the environmental variable EXINIT.

EXINIT="set nu"; export EXINIT

https://engineering.purdue.edu/ECN/S...ingLineNumbers
 
Old 01-18-2008, 04:51 PM   #3
dwhitney67
Senior Member
 
Registered: Jun 2006
Location: Maryland
Distribution: Kubuntu, Fedora, RHEL
Posts: 1,533

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
I presume you mean you would like to have line numbers displayed. The 'vi' command to enable this is:

Code:
:set nu
or
Code:
:set number
To disable:

Code:
:set nonu
To enable line numbering each and every time you enter 'vi', insert "set nu" in a file called ~/.vimrc.
 
Old 01-18-2008, 05:04 PM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Rep: Reputation: 299Reputation: 299Reputation: 299
.vimrc is for vim.

For vi which most likely is linked to elvis (

ls -l `which vi`

)

the file can be ~/.exrc, ~/.elvisrc, or ~\elvis.rc

From the man page:

Quote:
~/.exrc, ~/.elvisrc, or ~\elvis.rc
The .exrc or .elvisrc (for UNIX) or elvis.rc (for non-UNIX) file in your
home directory will generally be executed as a series of EX commands, unless
the EXINIT environment variable is defined. This behavior isn't built into
Elvis though; it is handled by the standard elvis.ini file.

.exrc, .elvisrc, or elvis.rc
The .exrc or .elvisrc (for UNIX) or elvis.rc (for non-UNIX) file in the cur-
rent directory is interpreted as a series of EX commands, but only if the
exrc option has been set. This behavior isn't built into Elvis; it is han-
dled by the standard elvis.ini file.
 
  


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
manipulating 64 bit numbers using 32 bit numbers. rajesh_b Programming 3 09-15-2006 10:03 AM
sequence of numbers, how to extract which numbers are missing jonlake Programming 13 06-26-2006 04:28 AM
Even numbers paraiso Linux - Newbie 4 05-15-2005 04:31 PM
Error message in setting up wlan... could be i fubared some numbers. Jehar Linux - Wireless Networking 0 04-02-2005 06:24 PM
Adding numbers, break on non-numbers... Cruger Programming 1 03-22-2004 10:18 AM


All times are GMT -5. The time now is 04:15 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