aliases | category | classification | date | date_modified | draft | id | image | links | local_archive_links | pinned | series | tags | title | type | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
vim |
public |
2020-06-19 03:05:44 -0700 |
2020-06-19 03:05:44 -0700 |
false |
20200619100544 |
false |
false |
|
Edit over SSH with Vim |
tech-note |
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
.