Edit over SSH with Vim

Vim can edit files remotely, on a server. It uses scp to copy it locally, allow you to work on it, and then it copies it back to the server. You can even use netrw to view remote directories, and then select a file to edit.

Firstly you need to add a host to your ssh config file:

Host <name>
    HostName <ip>
    User <username>
    IdentityFile <ssh-key>

Then you can simply edit as below:

# Directory:
vim scp://<name>//home/<username>/

# File:
vim scp://<name>//home/<username>/<file>.py

If you have an issue with the statusbar not displaying properly you can just refresh the screen with ^L.

About

I'm a technology professional who's been passionate about computers since my Grandad introduced me to an Intel 386 back in the 90s when I was a kid. Those moments inspired a passion within for technology, and I've been playing around with anything with a circuit board ever since. Whenever I have a moment you can probably find me working on something computer-related, and this is where I like to write about those moments.