Question: I have an alias defined
`alias svi='sudo /usr/bin/vim -i /home/jeff/.viminfo -u /home/jeff/.vimrc'` but when I type `svi myfile` I get 

> 
> Error detected while processing /home/jeff/.vimrc:  
> 
>  line 1:  
> 
>  E117: Unknown function: pathogen#infect
> 
> 
> 

It seems I need to force vim to scan my .vim directory before executing `call pathogen#infect()` How do I do that, and in general, how can I make sure that when I run `sudo vim` I get the same environment that I would have by just running `vim`?

Answer: 
> 
> how can I get my normal vim initialization when I execute sudo vim?
> 
> 
> 

By using `$ sudo -e filename` instead of `$ sudo vim filename`.

That command will:

1. ask for your password (if the sudoers security policy requires it);
2. make a copy of `filename` in `/tmp/`;
3. open it *as you* with the first editor found by checking the following, in order: `$SUDO_EDITOR`, `$VISUAL`, `$EDITOR`, and finally the list of editors specified in /etc/sudoers;
4. copy it back to the original filename on write.

Refer to `man sudo` and `man sudoers` for more information.
While I intend to accept @romainl's answer as the preferred solution (after he tweaks it a little), I took another crack at researching a solution to the error I was getting because I hate it when computers get the better of me.

It turns out the error has to do with how the vim `runtimepath` option resolves when running as root. So to correct the error, I changed my alias slightly to `alias svi='sudo /usr/bin/vim -i /home/jeff/.viminfo -u /home/jeff/.svimrc'` and put the following three lines into /home/jeff/.svimrc

```
set runtimepath=$HOME/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,$HOME/.vim/after,/home/jeff/.vim
source /etc/vimrc
source /home/jeff/.vimrc

```

I no longer get the error and my custom stuff seems to be working (so far). But if I run into any other glitches, I will peruse `:help initialization` some more to see what else should go into my .svimrc file....