Reputation: 62588
One of vim's more often used configurations is having a folder structure like this
\[vimfiles]
\[vim73]
\_vimrc
How can I start vim with _vimrc and [vimfiles] being in some other folder? The folder in question in not one of those which vim upon starting checks automatically?
Upvotes: 10
Views: 5309
Reputation: 6292
Suppose the new path will be C:\Config\Username\Vim
;
Create a user environment variable VIMINIT
and set it to source C:\Config\Username\Vim\_viminit
;
Create C:\Config\Username\Vim\_viminit
and add source C:/Config/Username/_vimrc
to it;
Create that _vimrc
and add set runtimepath+=C:/Config/Username/Vim/vimfiles
to it;
(optional) Create C:\Config\Username\Vim\_gvimrc
for GUI specific settings and add the following at the end of _vimrc
in order to load it at startup:
if has("gui_running")
source C:/Config/Username/Vim/_gvimrc
endif
(optional) Add set viminfo+=nC:/Config/Username/Vim/_viminfo
to _vimrc
in order to also store the viminfo file in the custom location.
Upvotes: 0
Reputation: 38593
This is how I do it: https://github.com/mihaifm/vimfiles
Let's say you have Vim installed in E:\Vim
and you want to load your vimfiles from D:\Dropbox\vimfiles
Edit your E:\Vim\_vimrc
like this:
set rtp+=D:\Dropbox\vimfiles
source D:\Dropbox\vimfiles\_vimrc
Alternatively you can create symbolic links with the mklink
and junction
tools.
Upvotes: 4
Reputation: 172768
You can pass a custom location for the ~/.vimrc
file; :help startup
has all the details. For example, you could pass a file location via -u
, or define a :source file
command in the environment variable VIMINIT
.
Once you're running your own vimrc file, the loading of plugins is determined by the 'runtimepath'
option. Therefore, if you want to use a non-default location (not ~/.vim
/ ~/vimfiles
), just :set runtimepath=...
to it.
Upvotes: 6