Thursday, April 8, 2010

Re: common vimrc for users and super user

On 04/08/2010 09:06 PM, joy c wrote:
> How can I have a command .vimrc , plugins and other vim settings
> common to both users and root user?
>
> Currently I have everything set up with my username when I su to root
> all my vim settings are gone.

Since (for the most part) I'm the only vim-user on my linux boxes
that also has root privs (there are some other admins that don't
use vim, and other vim users that aren't admin), I usually just
use a soft-link:

tim@rubbish:/home/tim$ su
root@rubbish:/home/tim# cd ~
root@rubbish:/root# ln -s ~tim/.vimrc ~/.vimrc
root@rubbish:/root# ln -s ~tim/.vim ~/.vim

since root is allowed to read anybody's files.

If you have some root-specific things, you could have a vimrc
something like

source /home/tim/.vimrc
" set other root-specific stuff here...

though it may not find files within ~tim/.vim such as local
file-types and color-schemes, so you may have to link that much
or twiddle variables.

Another option would be to keep them under version control (such
as svn/hg/git/bzr) and then sync them up occasionally. This
allows for bidirectional sharing between the two, yet you can
edit one (your user or root vimrc) and still cherry-pick to
exclude portions when pushing to the other.

I prefer not to mess with the /etc/vimrc on the assumption that
by leaving it alone, upgrades won't try to make me think about it.

-tim


--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

To unsubscribe, reply using "remove me" as the subject.

No comments: