Context: I'm trying to use vim's clientserver mode on Mac OS X, using iterm2. I've compiled vim with clientserver via brew, and I've got XQuartz installed also. This is to allow continuous compilation for the vimtex plugin.

When opening vim with

vim --servername VIM

it opens vim seemingly as normal, but v:servername stays empty, and from another terminal calling vim --serverlist gives no output (not even an error). To me, it seems like vim isn't really creating a server at all?


  • 1
    What is the output of :echo has('clientserver') when you start Vim? This should be 1 of the feature is compiled in (regardless of whether or not the v:servername is defined). – Karl Yngve Lervåg Oct 4 '17 at 11:30
  • I'll check this when I'm back at my machine, but I installed vim using brew install vim --with-client-server, after installing xquartz though brew. – B. Mehta Oct 4 '17 at 13:38
  • I have no idea how things work on OSX and why your brew command might have not worked. But before looking into that you should ensure that you know that this is the problem (which I think it is). – Karl Yngve Lervåg Oct 4 '17 at 13:44
  • :echo has('clientserver') gives 1 – B. Mehta Oct 4 '17 at 14:23
  • Strange. In this case it seems like it should work. I'm sorry that I can't be of more help... – Karl Yngve Lervåg Oct 4 '17 at 21:49

I had exactly the same problem when trying to get vimtex working with Skim. That is, I had vim 8 installed with --with-client-server (showing as +clientserver) and XQuartz running but --servername option was just ignored.

The solution for me was setting DISPLAY:

export DISPLAY=:0.0

After that everything worked exactly as it should.

Edit: help x11-clientserver says

The communication between client and server goes through the X server. The display of the Vim server must be specified. The usual protection of the X server is used, you must be able to open a window on the X server for the communication to work. It is possible to communicate between different systems.

| improve this answer | |
  • What version of Vim 8? Looks like this might have be a bug, as Patch 8.0.0507 apparently fixes the problem: "Client-server tests fail when $DISPLAY is not set." (See :help vim8) – Rich Jan 29 '18 at 14:19
  • @Rich Vim 8.0.1400. The way I read the comment for 8.0.0507 is that it says tests were failing if DISPLAY was not set. Reading through the lines, my guess is they failed because DISPLAY needs to be set for client-server to work (but it's just my guess!) – lemonad Jan 29 '18 at 19:26
  • 1
    I was reading "tests" as "check" rather than "unit tests", but seeing as your issue exists after that patch I guess your interpretation is more likely! – Rich Jan 29 '18 at 23:22
  • Is anyone able to make this work? I'm building Vim 8.2, +clientserver is enabled, I have XQuartz running, I set the DISPLAY variable. Still no server in the list. – Dominique Apr 11 at 23:38

clientserver needs X11 for working. So on OSX, you have to run XQuartz. Also, be sure that your vim is not a symlink to mvim with the -v option (mvim -v would run vim in terminal mode without X11 features, from my understanding).

| improve this answer | |
  • I had xquartz running, and didn't have mvim installed. But the suggestion to switch to neovim worked – B. Mehta Oct 6 '17 at 7:18
  • @B.Mehta Why would neovim work, since they removed the --servername feature? – Christian Brabandt Jan 4 '18 at 9:39
  • @ChristianBrabandt I'm not entirely sure but I've been using it successfully since October. – B. Mehta Jan 4 '18 at 13:10
  • I thought neovim removed --servername, but cannot find it in the docs. Only found this issue: github.com/neovim/neovim/issues/1750 (which does not mention --servername) – Christian Brabandt Jan 4 '18 at 13:19
  • @ChristianBrabandt Try using neovim-remote instead. – B. Mehta Jan 27 '18 at 19:58

Your Answer

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

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