如何更改 .vimrc 和 .vim 的位置 [英] howto change location of .vimrc and .vim

查看:44
本文介绍了如何更改 .vimrc 和 .vim 的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改 .vim 文件夹和 .vimrc 文件的位置,以便可以使用两个(或更多)独立版本的 vim?有没有办法在从源代码编译 vim 时配置它?(也许是 feature.h 中的一个条目?)

How can I change the location of the .vim folder and the .vimrc file so that I can use two (or more) independent versions of vim? Is there a way to configure that while compiling vim from source? (maybe an entry in the feature.h?)

我为什么要做这样的事情?:我必须在使用 python2 和 python3 的项目上工作,因此我想有两个独立的 vim 设置,具有不同的插件、配置等.此外,一个版本必须用 +python 编译,另一个版本必须用 +python3.

Why do I want to do such a thing?: I have to work on project that use python2 as well as python3, therefore I want to have two independent vim setups with different plugins, configurations etc. Moreover, one version has to be compiled with +python, the other with +python3.

推荐答案

注意:我真的不建议这样做.

Note: I don't really recommend doing this.

如果你真的想重新编译 vim 以便它使用不同的 vimrc 和不同的配置目录,请查看 src/feature.h

If you really really want to recompile vim so that it uses a different vimrc and different configuration directory take a look at src/feature.h

在此文件中搜索 USR_VIMRC_FILE.取消注释并将您的 vimrc 的名称放在这里.这将更改默认的 vimrc 文件.

Search this file for USR_VIMRC_FILE. Uncomment it and place the name of your vimrc here. This will change the defualt vimrc file.

所以它应该看起来像这样

So it should look something like this

#define USR_VIMRC_FILE "~/path/to/vimrc"

src/os_unix.hsrc/os_mac.h 中搜索 DFLT_RUNTIMEPATH.将 ~/.vim 的所有实例更改为您想要的任何文件夹.这应该设置 vim 搜索设置的默认运行时路径.

Inside src/os_unix.h or src/os_mac.h and search for DFLT_RUNTIMEPATH. Change all instance of ~/.vim to whatever folder you want. This should set the default runtime path that vim searches for settings.

这篇关于如何更改 .vimrc 和 .vim 的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆