Is it possible to have an existing vim instance launch a server from within, without using the --servername command-line option? (I would want to do this from a FileType autocommand).

Alternatively, is there any inconvenient in setting up a shell alias vim='vim --servername $$' (or any other unique identifier), so that any vim instance is its own server? (Then when I need to contact a specific one, I can always patch something up out of --serverlist and --remote-cmd).

  • 1
    AFAIK any Vim instance is already its own server, and its instance name can be found by reading the v:servername variable. See also :h clientserver (the "SERVER NAME" section). – VanLaser May 9 '16 at 14:48
  • 1
    I just tried this and it works for gvim but not for terminal-bound vim, which is my use case. (Although client-server still works with these). However, your answer suggests that no, there is no counter-indication to always having a server on. – Circonflexe May 10 '16 at 13:13
  • So all is good :) – VanLaser May 10 '16 at 21:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.