Logging onto an remote server and editing a file via vi(m) requires three things (to do it securely):
- (Open)SSH: the tool of choice for (almost) every network-operation.
- (g)VIM: the
ugly monster editor of choice to those that have seen the light.
- a fast enough, not otherwise used, stable network-connection to be able to work fluently and not loose your changes.
If you do not want to depend on number 3 (for example get disturbed by an improperly configured backup-operation or someone else putting heavy load onto the server or by faulty connections), do it this way:
Open your files using the (amazingly extended) netrw plugin VIM brings along since version 6. Just open your files via :e scp://<username>@<servername>//<dir>/<file>. Or even shorter (if ssh is configured correctly) via gvim scp://<servershortcut>/<somedir>/ - if your scp-command ends with a slash, VIM will give you the :E-exploring-mode on the remote server. I’m loving it!
PS: And I also love it, that I do not have to install vim at every remote computer I want to edit files at and that I am able to edit files on headless servers with the g-version of vim.