On windows I use gvim, and like to keep just one gvim instance running. Most of the time I open files like this: gvim -p --remote-tab-silent FILES. However, sometimes I want to open a tag in that same remote gvim server in a new tab. If I do gvim -t MYFUNCTION --remote-tab-silent it tells me it wants a file name after the last argument. If I do gvim --remote-tab-silent -t MYFUNCTION it opens a new tab with a split window with two files, one named literally -t and the other named MYFUNCTION. I've also tried using -- to end the arguments list, but then I end up editing a file named --.

How can I open a tag in my existing gvim instance?

  • Can you not just switch to the gvim instance and run :tag whatever? Why do you need this on the command line
    – D. Ben Knoble
    Commented May 3, 2019 at 1:47
  • 1
    Have you tried vim --remote-expr "execute('tag MYFUNCTION')"? Or vim --remote-send ":tag MYFUNCTION<cr>"
    – Ralf
    Commented May 3, 2019 at 15:52
  • @D.BenKnoble sometimes I have a long function name which I can paste into the command line, but can't paste into the gvim command bar (or whatever the : bar is called)
    – Muricula
    Commented May 3, 2019 at 18:03
  • Can you use the * register on windows gvim? If so: :tag <C-r>*...
    – D. Ben Knoble
    Commented May 3, 2019 at 18:13

1 Answer 1


I tweaked an example which Ralf mentioned in the comments to get this: gvim --server=$SERVER --remote-send ":execute('tab tag $tag')<CR>" Remote send sends the following commands to the gvim server. <CR> is the return character.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.