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?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With