Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting vim with vimfiles in a certain location

Tags:

vim

windows-7

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?

like image 723
Rook Avatar asked Jul 20 '13 11:07

Rook


People also ask

Where is .vimrc file located?

The global or system-wide vim configuration file is generally located under the /etc/vim/vimrc . This configuration file is applied to all users and when Vim is started this configuration file is read and Vim is configured according to this file contents.

Where does Vim look for Vimrc Windows?

vimrc The files are searched in the order specified above and only the first one that is found is read. RECOMMENDATION: Put all your Vim configuration stuff in the $HOME/. vim/ directory ($HOME/vimfiles/ for MS-Windows). That makes it easy to copy it to another system.

How do I open a .vimrc file in Windows?

Opening vimrc Using file name completion, you could type :e $M then press Tab until you see the desired variable. If you only want to see the path, type :echo $M then press Tab to see the variable, and press Enter. In gvim, the Edit menu includes "Startup Settings" which will use $MYVIMRC to edit your vimrc file.


2 Answers

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.

like image 141
Ingo Karkat Avatar answered Sep 29 '22 17:09

Ingo Karkat


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.

like image 25
mihai Avatar answered Sep 29 '22 19:09

mihai