如何根据可执行文件名为Vim指定不同的配置?

时间:2022-03-16 19:36:47

I am trying to open Vim with different configuration options depending on the executable file name. I intend to create a number of symbolic links to vim and I'd like to do something like this in my .vimrc

我试图使用不同的配置选项打开Vim,具体取决于可执行文件名。我打算创建一些vim的符号链接,我想在我的.vimrc中做这样的事情。

if execname == "vim2"
   " configuration here
endif

Is there a variable in Vim that holds the name of the executable file being run? Alternatively, is there another way I can have different configurations without having to keep more than one .vimrc file?

Vim中是否有一个变量来保存正在运行的可执行文件的名称?或者,还有另一种方法,我可以有不同的配置,而不必保留多个.vimrc文件?

2 个解决方案

#1


1  

You are looking for the variable v:progname.

您正在寻找变量v:progname。

#2


0  

You can simply make each desired name to be an alias which first renames .vimrc.configX into .vimrc before calling vim

您可以简单地将每个所需的名称作为别名,在调用vim之前首先将.vimrc.configX重命名为.vimrc。

#1


1  

You are looking for the variable v:progname.

您正在寻找变量v:progname。

#2


0  

You can simply make each desired name to be an alias which first renames .vimrc.configX into .vimrc before calling vim

您可以简单地将每个所需的名称作为别名,在调用vim之前首先将.vimrc.configX重命名为.vimrc。