Open anjiro opened 3 years ago
Right now, command scp
is a wrapper around curl
.
As to the remote editing problem, it may have something to do with the authentication. You can refer to https://github.com/terrychou/iVim/wiki/External-Command:-ssh for some details.
Yes, I followed those instructions and authentication seems to work; for example, netrw
can list directory contents and I can run :!ssh user@host
without being asked for a password. But the problems above happen even so.
I've figured out the issue. Regular scp
defaults to paths relative to the home directory; that is, scp user@host:file.txt
will get file.txt
from user
's home directory. But curl
assumes paths relative to root, so curl -u user: scp://host/file.txt
will try to get file.txt
from /
. Instead, you have to use curl -u user: scp://host/~/file.txt
.
When using netrw
to browse a directory via :e scp://user@host/
, it correctly lists buser
's home directory, but when selecting a file to edit, the call to curl
doesn't include the ~
(probably because netrw
is expecting stock scp
rather than curl
), so the result is an empty file. The same issue likely is happening on the write-side.
Yes, you are right. It behaves like this is right because of the curl
wrapping implementation.
When I run
!scp user@host file .
I see the curl progress indicator followed by an error message. Depending on whether the remote host has vim's SSH key, eithercurl (67) authentication failure
orcurl (79) failed to recv file
.This problem also manifests when trying to edit a remote file (
:e scp://...
); there are no errors, but the file is always empty and changes are never written to the remote.