3

I want to use netrw to edit remote files on my vps. Unfortunately, when I enter

vim scp://cydiater_server:~/demo/sol.cpp  

and try to save something with :w Vim prompts me with

:!rcp  '/var/folders/74/flchcrkd4yx4d553byw606sr0000gn/T/vNVVwLF/0' 'scp://cydiater_server:~/demo/sol.cpp'
zsh:1: command not found: rcp

which seems that I don't have rcp in my host. But what I'm using is scp, why vim needs to use rcp?

2
0

Just one thing caught my eye looking at this: the SCP path used when launching vim doesn't match paths shown in the netrw docs. For instance under :h netrw-url...

scp://[user@]host/path

And as :h netrw-path explains a little later

Paths to files are generally user-directory relative for most protocols. Examples:

vim scp://user@host/somefile

vim scp://user@host/subdir1/subdir2/somefile

Given the possibility that your use of a non-standard path format may be throwing off netrw when you try to save, I suggest opening the file with:

vim scp://cydiater_server/demo/sol.cpp

or

vim scp://yourusername@cydiater_server/demo/sol.cpp

(I believe which one you choose depends on how authentication is set up.)


FYI, to use an absolute path, rooted at /, you use a double slash after the hostname like so

vim scp://user@host//foo/bar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.