Running vim with vimfiles in a specific location

One of the most commonly used vim configurations has a folder structure like this

\[vimfiles] \[vim73] \_vimrc 

How can I run vim with _vimrc and [vimfiles] in another folder? In this folder there are none of those that automatically start when the scan starts?

+6
source share
3 answers

You can pass a custom location for the ~/.vimrc file; :help startup contains all the details. For example, you can pass the file location via -u or define the command :source file in the VIMINIT environment VIMINIT .

Once you run your own vimrc file, loading plugins is determined by the 'runtimepath' option. Therefore, if you want to use a non-default location (not ~/.vim / ~/vimfiles ), simply :set runtimepath=... to it.

+5
source

Here's how I do it: https://github.com/mihaifm/vimfiles

Say you have Vim installed in E:\Vim and you want to download your vimfiles from D:\Dropbox\vimfiles

Change your E:\Vim\_vimrc as follows:

 set rtp+=D:\Dropbox\vimfiles source D:\Dropbox\vimfiles\_vimrc 

Alternatively, you can create symbolic links with the mklink and junction tools.

+4
source
  • Suppose the new path is C:\Config\Username\Vim ;

  • Create an environment variable VIMINIT and set its source C:\Config\Username\Vim\_viminit ;

  • Create C:\Config\Username\Vim\_viminit and add source C:/Config/Username/_vimrc to it;

  • Create this _vimrc and add set runtimepath+=C:/Config/Username/Vim/vimfiles to it;

  • (optional) Create C:\Config\Username\Vim\_gvimrc for your specific GUI settings and add the following at the end of _vimrc 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 to save the viminfo file in a custom location.

0
source

Source: https://habr.com/ru/post/949893/


All Articles