1

I read somewhere that you can use a socket do clientserver functionality but I can't figure out where the socket is.

Is it a file socket in the file system like mysql used to use?

Is it a tcp socket?

I don't see it mentioned anywhere in the remote.txt help file.

The reason I ask is that I'm using WSL2 and I can't seem to get a list of servers with vim --serverlist even though I have a Vim server running.

leeand00
  • 3,555
  • 5
  • 24
  • 40

1 Answers1

1

For the --serverlist functionality to work you need to have a version of Vim compiled with the clientserver functionality.

You can check if your version has been compiled with that functionality using the Vim command: :version

Remark: I have installed WSL2 with the default Ubuntu distribution and the clientserver functionality is not present. I fear you have the same problem.

With this you could:

  • Start Vim as a server with the following bash command:
vim --servername "VIM"
  • Query the server name associated to an instance (e.g. VIM or VIM1 or GVIM) with the following Vim command:
:echo v:servername
  • Send some keys to another instance with the following bash command:
vim --servername "VIM" --remote-send "iHello World!<Esc>"
Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
  • 1
    But I have the Gtk3 version installed and it has +clientserver; I checked:

    https://askubuntu.com/questions/1378830/how-to-install-vim-with-clientserver-feature-enabled-on-ubuntu-20-04

    – leeand00 Mar 07 '24 at 11:48
  • Maybe you could try the experiment I propose in my answer and let us know what are the intermediate result (I noticed that vim --server-list show me the list of server only for 1 second) – Vivian De Smedt Mar 07 '24 at 12:04
  • 1
    I noticed that on Linux if no server name is given the server is not started. I have adapted the answer accordingly. – Vivian De Smedt Mar 07 '24 at 12:17