Since my question Setting servername in vimrc as opposed to command line switch turned out not to be feasible, I am looking for help. Is there some way that I can tell apart different instances of gvim?
Scenario: I am making a lightweight realtime LaTeX plugin for vim. Currently it works as long as I only have one instance of gvim running. But, if I have two .tex files open in separate windows, the command I am using to get my previewer, yap, to talk to vim
"C:\Program Files (x86)\Vim\vim73\gvim.exe" --remote +%l "%f
doesn’t always talk to the correct instance of gvim running. In my previous question I was trying to use the --servername option to get it to talk to the correct instance, but since I am opening gvim by right clicking->open with->gvim, and since I can’t set the servername at runtime, I can’t get each instance of gvim to get a unique servername.
So is there some way that I could uniquely identify each instance of gvim? My last resort hack would be to use autohotkey to parse the name of the file in the window title and send the keys through autohotkey, but I feel like there should be a simpler way…
Every launched Vim instance will automatically have a unique
v:servername; on Windows, I getGVIM,GVIM1,GVIM2, …(Already mentioned by Peter Rincker in the comments.)