Open file in correct g/mvim instance/server
kiryph opened this issue · comments
Occasionally, I like to have two gui windows (e.g. multi monitor setup or multiple OSX spaces/Linux workspaces).
Therefore, gui window 1 has a certain set of files open and also the gui window 2. both sets are disjoint.
For simplicity, gui window 1 has file1 and gui window 2 has file2.
I would like to run following commands:
$ vimer +20 file1
$ vimer +40 file2
which should open the correct gui window and reposition the cursor.
My use case is a latex setup using synctex. That means the pdf viewer is re-opening/focusing gvim/mvim and moves appproximately the cursor to the line where you have clicked in the pdf viewer.
Do you think you would like to extend your script to handle multiple gvim servers?
See also
https://sourceforge.net/p/skim-app/wiki/TeX_and_PDF_Synchronization/#tex-pdf-synchronization
and possibly helpful
http://www.vim.org/scripts/script.php?script_id=4131
@kiryph A -s
or --server
option was added to specify the GVim server name (which corresponds to a GUI window) to specify which window the files should be opened in. See #1 for details.
If this does not fulfill your use case, then I am afraid, due to my busy schedule and lack of interest in this use case, I won't be able to extend the script to support your use case. But I am open to accepting pull requests or patches from you or anyone that supports your use case. If I find the use case useful in general I will apply your pull request or patch. If not, I will add a link to your fork or patch in my README.md.
@susam Thanks for your response. I think I was aware of the -s
option which does not help here, because the settings of the pdf viewer for opening the editor via synctex are global. This means the option is used for all pdfs opened in skim
or whatever pdf viewer you are using.
In the meantime I came across solutions of other people: