LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 02:53 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, USA
Distribution: VMware V12 and V15 in Windows 10, MX Linux 23.1, Kubuntu 23.10, IBM z/VM 5.4
Posts: 558

Rep: Reputation: 34
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, 03:51 PM   #2
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

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

EXINIT="set nu"; export EXINIT

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

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, 04:04 PM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
.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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:58 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
Open Source Consulting | Domain Registration