LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   VI Line Number Problem (https://www.linuxquestions.org/questions/linux-newbie-8/vi-line-number-problem-4175451428/)

swamprat 02-23-2013 01:55 PM

VI Line Number Problem
 
Greetings all,

I needed to have line numbers when I either edit or create new members with VI

I created the file .vimrc in /home/myuserid and included the line ‘set num’ (no quote marks) and it worked fine.

However when I do an su on my user id to do administrative tasks and have to use VI the line numbers no longer appear.

I'm using CentOS 6.3 and Gnome.

How can I resolve this problem?

Thanks

druuna 02-23-2013 02:31 PM

The .vimrc file you created is only used by that specific user (/home/myuserid).

You have 2 possibilities:

1) also create a .vimrc for the root user,
2) make it global for all users and add it to /etc/vimrc

swamprat 02-23-2013 02:35 PM

Thanks druuna,

Do I need a '.' in front of the vimrc file (.vimrc) in the etc directory?

druuna 02-23-2013 02:38 PM

Quote:

Originally Posted by swamprat (Post 4898310)
Thanks druuna,

Do I need a '.' in front of the vimrc file (.vimrc) in the etc directory?

Nope, you don't.

The dot version (.vimrc) is only used in the users/root home-directory.

Isn't there a /etc/vimrc already? Most distro have one (maybe it is stored in /etc/vim/vimrc, do check).

swamprat 02-23-2013 03:55 PM

druuna,

There is a vimrc file in the etc directory and it is a script. which I backed up and add the set nu line.

Logged off and back on did a vi test but on line numbers but it didn't work.

I found a file in the etc directory called virc backed it up and add the set nu line to the active virc file and now when I su to root or just su the line numbers are there.

Thank you again for leading me down the right path.


All times are GMT -5. The time now is 06:06 AM.