LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   color syntax in vi for root (https://www.linuxquestions.org/questions/linux-newbie-8/color-syntax-in-vi-for-root-614622/)

ufmale 01-18-2008 05:51 PM

color syntax in vi for root
 
I am trying to setup a color syntax for vi. I was successfully set it up by creating writing "syntax on" in the .vimrc at the home/user1/ directory.

However, i cannot get it to work for root user. I copy the .vimrc from /home/user1/.vimrc to the /root/ . I am not sure if there is any limitation on using this file for root user? i am using fedora 7.

sycamorex 01-18-2008 05:56 PM

Try:

Quote:

/usr/share/vim/vimrc
System wide Vim initializations.

ufmale 01-18-2008 06:27 PM

I don't have the /usr/share/vim/vimrc file,
but there are /usr/share/vim/vim71/ and /usr/share/vim/vimfiles

I try to create that file under vim71, but it did not work.

marciobarbalho 01-18-2008 07:18 PM

Quote:

Originally Posted by ufmale (Post 3027591)
I don't have the /usr/share/vim/vimrc file,
but there are /usr/share/vim/vim71/ and /usr/share/vim/vimfiles

I try to create that file under vim71, but it did not work.

In order to create the .vimrc file you have to run gvim on terminal:

root@localhost~# gvim &

then... menu Edit -> Startup Settings

type "i" to edit file and feel for typing anything you want

sircharles4848 02-06-2009 07:29 AM

Quote:

Originally Posted by ufmale (Post 3027568)
I am trying to setup a color syntax for vi. I was successfully set it up by creating writing "syntax on" in the .vimrc at the home/user1/ directory.

However, i cannot get it to work for root user. I copy the .vimrc from /home/user1/.vimrc to the /root/ . I am not sure if there is any limitation on using this file for root user? i am using fedora 7.


All I did was alias vi to vim, in my .bashrc file, then reload .bashrc

vi ~/.bashrc
alias vi='vim'
(save and exit)
(then run)
. ~/.bashrc

gacanepa 05-30-2012 08:22 AM

Quote:

Originally Posted by ufmale (Post 3027568)
I am trying to setup a color syntax for vi. I was successfully set it up by creating writing "syntax on" in the .vimrc at the home/user1/ directory.

However, i cannot get it to work for root user. I copy the .vimrc from /home/user1/.vimrc to the /root/ . I am not sure if there is any limitation on using this file for root user? i am using fedora 7.

I apologize if replying to this post after such a long time is considered "bad forum practice" - just wanted to add something in case someone else is looking for the same answer. Besides, I think it contributes to document the solution.
In my case, I am running Debian Squeeze and the system-wide options for VI are located in /etc/vim/vimrc. Just uncomment the line "syntax on" and you're ready to go.
Also, if you want to show line numbers, add "set number" on another line.


All times are GMT -5. The time now is 11:03 PM.