让gVim始终运行一个实例 [英] Let gVim always run a single instance

查看:206
本文介绍了让gVim始终运行一个实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种方法可以让gVim仅运行一个实例,以便使用它打开新文件时,它会自动在当前正在运行的实例的新选项卡中打开?

Is there a way to let gVim only run a single instance, so that when a new file is opened with it it's automatically opened in a new tab in the currently running instance?

我知道您可以通过传递--remote-tab-silent来做到这一点,但我想配置gvim使其成为默认行为.也就是说,我想输入gvim filename并使其表现得就像我将--remote-tab-silent选项传递给它一样.

I know you can do that by passing --remote-tab-silent but I want to configure gvim so that this becomes the default behavior. i.e. I want to type gvim filename and make it act as if I passed the --remote-tab-silent option to it.

gVim 7.2

我在Windows(Vista)上

I'm on windows (vista)

推荐答案

如果您正在使用bash shell(在Linux/OS X上/使用Cygwin)是要添加~/.bashrc文件:

If you are using the bash shell (on Linux/OS X/using Cygwin) is to add you ~/.bashrc file:

gvim () { command gvim --remote-silent "$@" || command gvim "$@"; }

在Windows上,我认为您可以使用gvim.bat批处理脚本来实现相同的目的.

On Windows I think you could have a gvim.bat batch-script to achieve the same..

gvim.exe -p --remote-tab-silent %1 %*

如果gvim.exe不在您的路径中

If gvim.exe isn't in your path

Run > Search "Environment"

为当前用户或系统编辑PATH变量.

Edit PATH var for current user or system.

这篇关于让gVim始终运行一个实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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