On 6 March 2011 00:36, E. Wing wrote:
> I use mvim a lot to open files. I often get into situations where I
> have so many open files, I don't remember which I left open and which
> I closed. And when I try to open an already open file, I get the
> Alert: "Swap file "foo.swp" already exists!" and a bunch of options,
> none of which brings the current open window/tab forward.
>
> Is there a way to get mvim to bring forward the already open window or
> tab of the file I request (assuming it is open)? And if the file isn't
> already open, I would expect mvim to do what it currently does.
>
> I looked at the --remote-tab-silent switch. It seems close to what I
> want, but I don't want these things in new tabs, but windows when not
> already open. It also seems to get confused if I have an additional
> parameter like the line number:
> mvim --remote-tab-silent-switch +60
> Instead of jumping to line 60, it opens a second tab called +60.
>
> Any suggestions?

The only easy way to achieve this is to use "open -a MacVim filename"
but that won't let you pass parameters.

I don't have an easy solution if you need to pass parameters as well.
The only thing I can think of is to write a script which queries all
open Vim servers for a list of open filenames using --serverlist to
get all Vim servers, then --remote-expr to query each server for open
files.  If a file is found to be open, then raise that server with
--remote-send.  This is done by MacVim, the relevant code is inside
MMAppController.m -- search for "addVimInput" (which is basically
--remote-send) and "evaluateVimExpression" (which is basically
--remote-expr).

Björn

-- 
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to