How can I tell vim where my _vimrc and plugins are

江枫思渺然 提交于 2019-12-25 01:48:52

问题


At work I have gvim installed in C:/Program Files/vim but have no write permission on this folder. I would like vim to use my personal _vimrc and potentially some addins that would be in a bundle directory. Problem is that vim choose the default _vimrc in C:/...

What can I do to fix my problem, I was thinking of a script but I can't manage in writing one that work... ?

EDIT: Off course I do not have admin rights


回答1:


Your configuration belongs in %HOME% (or %USERPROFILE% if the former isn't set). You can always override that by setting the %MYVIMRC% environment variable (e.g. in the Windows Control Panel under Advanced System Settings) passing a different configuration script via -u path/to/vimrc. (Defining %VIMINIT% should work, too, but I didn't get it to work on Windows.) See :help startup for details.




回答2:


The first place Vim looks for initializations (see :h .vimrc) is in your home directory. (If you're not sure where this is, you can use echo %HOMEPATH% from the command prompt to find out.)




回答3:


Vim will use the _vimrc in your home directory if it exists, so you could just copy it there (%userprofile%_vimrc), or you could set the environment variable $VIM to the directory of your choice. You can set an environment variable on Windows by right-clicking on My Computer -> Properties -> Advanced System Settings. For more info see the vim docs.



来源:https://stackoverflow.com/questions/20081371/how-can-i-tell-vim-where-my-vimrc-and-plugins-are

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!