Alex
Alex

Reputation: 10136

Use another directory as .vim

I am working on a plugin for Vim, and sometimes I have issues, that can't be reproduced with my plugin set. I would like to get users .vim and .vimrc, but I don't want to replace/move my files.

I want to know if it possible to set another directory to be used as .vim and another file as .vimrc?

Upvotes: 1

Views: 271

Answers (3)

Hunaphu
Hunaphu

Reputation: 700

A simple solution is to use a symbolic link for the folder.

Note that if you put .vimrc in .vim the . should be removed from the name: .vim/vimrc.

my:
       ln -sfn .vim myvimconf

friend:
       ln -sfn .vim friendvimconf

Upvotes: 1

JJoao
JJoao

Reputation: 5367

I am not sure but I once used

vim -u ~otheruser/.vimrc -U ~otheruser/.gvimrc   file 

Edit: This is not enough; please see @Ingo solution

Upvotes: 0

Ingo Karkat
Ingo Karkat

Reputation: 172768

Building upon @JJoao's answer, you need to explicitly specify the .[g]vimrc locations, and additionally replace the references to ~/.vim in your 'runtimepath':

vim \
-u ~user/.vimrc -U ~user/.gvimrc \
--cmd "set rtp-=~/.vim" --cmd "set rtp-=~/.vim/after" \
--cmd "set rtp^=~user/.vim" --cmd "set rtp+=~user/.vim/after"

Upvotes: 4

Related Questions