Friday, April 18, 2014

Re: Multiple vim configurations for root

On 2014-04-18, Magee, Fred wrote:
> The other Linux system admin and I have dramatically different ideas about how
> vim should be configured. Is it possible for me to create a test for user id
> and use my vim configuration including plugins etc. that I can use when using
> vim as root? For example is there an environment variable vim uses for config
> files I can set when I su to root?

You could use the VIMINIT environment variable and set it something
like this after you login as root:

VIMINIT=/home/fred/.root_vimrc

Vim sources your plugins from the directories in 'runtimepath' which
it builds on startup using the value of $HOME. To make Vim source
your personal plugins, put the following in /home/fred/.root_vimrc:

let &rtp = substitute(&rtp, "/root", "/home/fred", "g")
source /home/fred/.vimrc

To verify that you're getting the right set of plugins as you
experiment with the above, use the ":scriptnames" command.

See

:help VIMINIT
:help 'rtp'
:help :scriptnames

Regards,
Gary

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: