I've been a vim junkie for a year or so now and I've got some great little tricks burnt in to my memory. I do a lot of development (at the office) in a terminal on Ubuntu.

One of the things I value most is having tmux taking care of my sessions so that if Gnome, or anything else, decides to kirk out then I haven't lost a thing.

Additionally, I run a vim clientserver (C-b :neww 'vim --servername d') as one of my tmux windows and use it to receive any files I want to work with while I have my other tmux windows doing various jobs. It means I can have one vim open with no confusion about what I'm editing.

When I'm working remotely (via SSH,) I connect to my tmux session and carry on but I have one problem: vim won't start a client-server instance.

I presume it is X related but I can't seem to find the difference between a local tmux and a tmux via ssh.

  • The expression "kirk out" gives me the impression that your window manager has the habit of abruptly heading off to risa with green-skinned ladies. – intuited Apr 4 '11 at 7:18
  • @intuited cf. applegeeks.com/comic_archive/viewcomic.php?issue=135 – connrs Apr 4 '11 at 10:55
  • Oh, okay. I was also thinking that it might ———— start, and ———— stop, so ———— frequentlythatyoucan't! get! anything! ———— done! – intuited Apr 4 '11 at 18:37

Yes, it uses X properties to communicate. Try running your remote SSH session with the -X option to allow X11 forwarding. You may also have to enable that feature on the server side. You may also have to manually adjust the DISPLAY environment variable (to "localhost:10.0") since the existing session will already have your local one from when it started.


This really is more appropriate as a comment to @keith but I wanted to elaborate a little:

His answer solved it perfectly with a simple -X when connecting but I took it that one step further by adding to my .ssh/config file:

Host mydevserver.example.com
ForwardX11 yes

Additionally, I was tempted to investigate repeating this for a headless development server that's located off-site that I'm regularly working on.

  1. I installed the most basic X11 components with yum: yum group install 'X11 Desktop Environment'
  2. Created an alias in my zsh aliases file to start X on demand (performance still matters on a dev machine!)
    alias initFakeDisplay=startx -- /usr/bin/Xvfb :2 -screen 0 1024x768x24 &

Then in future, I can connect with X11 forwarding enabled and use the same tmux+vim technique to run a vim clientserver

  • I am trying to get a headless dev machine working how you are talking about. However even after i start the flex display calls to vim --remote* commands say there is no display. Any ideas? – macinjosh Apr 12 '16 at 17:11

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.