现有gvim的打开的文件多(新)选项卡 [英] Open files in existing Gvim in multiple (new) tabs

查看:547
本文介绍了现有gvim的打开的文件多(新)选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经把一些别名,在我的.bashrc在gvim中打开一个团体项目的文件,各自在自己的标签:

I have put some aliases in my .bashrc to open a group of project files in gvim, each in their own tab:

gvim -p <list of file names using absolute paths>

这是一切都很好,除了有文件的几个组,我可能想在任何给定的时间之间移动(我当前的项目使用Ruby on Rails的,这样解释)。什么是真正真棒是,如果我可以在新标签附加到的gvim现有实例。在我的最后一个位置我工作在Vista上;在文件名我身边这让通过打开一堆空的gvim标签,这让我右击并选择现有无名称gvim中打开。现在,我使用Ubuntu和有上下文菜单上没有这样的事情。有没有办法通过命令行做到这一点?

This is all well and good, except there are several groups of files I might want to move between at any given time (my current project uses Ruby on Rails, so that explains that). What would be really awesome is if I could append the new tabs to an existing instance of gvim. In my last position I worked on Vista; I got around this by opening a bunch of empty tabs in gvim, which allowed me to right-click on a filename and choose "Open in existing No-Name gvim." Now I use Ubuntu and there's no such thing on the context menu. Is there any way to do this from the command line?

推荐答案

如果VIM与客户端 - 服务器编译选项​​,你可以做到这一点。用下列标志启动您的vim实例:

If vim is compiled with the clientserver option, you can do it. Start your vim instance with the following flag:

$ gvim --servername GVIM  # GVIM is the server name. It can be anything.

要在这种情况下打开更多的标签,您可以运行命令:

To open more tabs in this instance, you can run the command:

$ gvim --servername GVIM --remote-tab file1 file2 file3 ...

Vim的客户机 - 服务器功能非常方便。它不限于打开文件;它可以用来发送任何指令使用命令行Vim的。例如,远程关闭vim的情况下,你可以使用:

The clientserver feature in vim is very handy. It's not limited to opening files; it can be used to send any command to vim using the command-line. For example, to close a vim instance remotely, you can use:

$ gvim --servername GVIM --remote-send '<Esc>:wqa<CR>'

这篇关于现有gvim的打开的文件多(新)选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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