Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My projects files are on a remote Linux server. The project can be very large. I need to find files within the project when using vim. If I mount the remote filesystem onto my local machine with sshfs, finding files would be very slow. So I have to run vim on the remote server. But I'd like to use MacVim running on my local machine. Is it possible to run vim on the remote server which sends the console and commands to my local machine via ssh such that MacVim can show everything sent from remote?

share|improve this question

migrated from Feb 20 '13 at 14:53

This question came from our site for professional and enthusiast programmers.

Can't you ssh into the machine and use Vim on that? That seems to be the most sensible and easy solution. – Tom Cammann Feb 20 '13 at 11:32
To solve this need once and for all, X11 was invented. Use SSH's X11 Forwarding and simply run gvim on the remote machine (needs an X11 server on your Mac). – Jens Feb 20 '13 at 13:45
And GVim and a X11 server on the remote machine. – romainl Feb 20 '13 at 15:43
up vote 3 down vote accepted

There is no client-server separation like in Emacs, so if remote file system access is out of the question, you have to launch Vim on the remote system. That would be either console Vim through your Mac OS terminal application, or (if you have an X server running), you can ssh -Y (X11 forwarding) and display a remote GVIM instance on your local system. It would be the Gnome-based Linux GVIM, not MacVim, but feature-wise very similar.

share|improve this answer

I face the same problem, gave up on SSHFS. It was slow, a little buggy, and like you I had trouble with operations such as git and find. I've been pretty happy doing the following:

# checkout my repo locally:
git clone <path to repo> <dirname>

# open vim edit edit edit

# use rsync to keep everything in sync (except my git files):
cd ..
rsync -avOz --exclude=.git/ <dirname>/ <remote host name>:<remote project dir>/

You could use some kind of file modification watch utility to kick off rsync automatically on file change, but I haven't really found a solution that works well for me...

An alternative idea I've been toying with: keep my dotvim files in github so that I can check them out remotely(my dotvim), and use Mosh for a more responsive editing experience.

share|improve this answer

If using a VCS and a local development server is not possible, I see three ways to go.

  1. Use an FTP/SFTP client. All the clients available on Mac OS X have an Edit in… button or menu that you can use to… edit files in MacVim. I do that often with some servers where, for one reason or another, we can't install a VCS. I suggest YummyFTP but there are free alternatives.

  2. Use Vim/MacVim's ability to browse and edit files on remote servers:

    :e scp://user@domain.ext/path/to/dir/

    See :h netrw for more info. It's a bit cumbersome for my taste but it works and you never have to leave your beloved editor.

  3. Edit the files directly on the server, using the Vim that is already there. You loose a bit of OS integration but you gain speed and, obviously, a direct access to the server's shell. You may feel handycaped by the absence of your plugins and ~/.vimrc but you could take it as an opportunity to work out on your Vim basics.

share|improve this answer
3. Absence of these? That's why you keep them in a VCS repository. There's no need to be without them. – Chris Morgan Feb 20 '13 at 12:26
I assumed that the server didn't have a VCS. If it did, the question would have never been asked IMO. – romainl Feb 20 '13 at 14:11
Care to explain the downvote? The three options above are perfectly valid ways to deal with the OP's problem. – romainl Feb 20 '13 at 15:44
You're almost certain to be able, very easily, to get Mercurial or Git going. Git will require standard build tools; Mercurial (my personal preference, I don't like Git though I work with it sometimes) will benefit from these but is content with just Python, which all servers will have. – Chris Morgan Feb 20 '13 at 18:29
No. My employer's dev server has Subversion but that's all and I don't even have SSH access. Using an FTP client or SVN is a much more reasonable option than arguing with the powers above about installing Git or Mercurial just so that I (the only Vimmer in the building) can use my editor on the server. For the record, I do keep my config in a VCS and use it on a number of VPSs I work on while freelancing. But you can't expect such a level of freedom all the time. – romainl Feb 20 '13 at 22:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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