TextMate 2 introudced rmate, which has become a de-facto standard for editing remote files, with multiple implementations of the remote component and client implementations for other editors, including Sublime Text and Visual Studio Code.

I'm not satisfied with the latency involved in saving files with Vim's built-in netrw (which has to run scp or sftp and thus open a new SSH session every time I save, blocking me from editing for a couple seconds). I'm not happy with the performance of editing via SSH filesystem mount (which doesn't let Vim know it's using a remote disk and can cause switching between GVim tabs to be quite slow, presumably as Vim talks to swap files or something). I want to edit with Vim via the rmate protocol, which maintains a persistent connection but is well aware of the remote nature of the file.

How can I use the rmate protocol with Vim? What plugin do I need? Is there a way to make netrw save via rmate instead of reconnecting every time?

  • 1
    You'll probably have to put together your own code for this, or work with someone who has a start. You could try a patch for vim in C that enables this, or write a vimscript plugin (possibly as a patch to netrw) to allow the protocol. Unfortunately, I'm not well-enough versed in any of those to give you more pointers, other than the vim mailing list and Dr. Chip's site. Best of luck, and welcome to Vi and Vim!
    – D. Ben Knoble
    Aug 31 '20 at 21:22
  • 1
    A quick search led me to github.com/wannesm/rmvim.vim, but it says "It uses the Netrw functionality of vim to remotely edit files" so maybe that doesn't solve your problem directly? Regarding using an sshfs, you can override the location of the swapfiles (by setting the 'directory' option), so maybe that would help with that particular use case?
    – filbranden
    Aug 31 '20 at 22:42

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.