1

Trying to edit files locally to remove the lag and not needing to sync my vim config. I can't figure out why this isn't working at all. If I do

vim scp://user@host/home/user/project/

I get

:!scp -q 'user@host/home/user/project/' 
'/var/folders/fm/vyvfk53d2b5gf63m7dnv3gqc0000gn/T/vGhn9Hf/0.txt'
"/var/folders/fm/vyvfk53d2b5gf63m7dnv3gqc0000gn/T/vGhn9Hf/0.txt" [New File]
Press ENTER or type command to continue

If I run just normal SCP commands they download just fine:

scp -r user@host:home/user/project/ project/
foo.txt                        100%   20     0.0KB/s   00:00

1 Answer 1

2

You need to specify two slashes // as manual describes:

vim scp://[email protected]//path/to/document

So for you use case:

vim scp://user@host//home/user/project/

but anyway with scp, you need to specify the file you want to edit, not only directory you want to browse through.

For directories, you need to use sftp, which has the ability to browse through the directories:

vim sftp://user@host//home/user/project/
Sign up to request clarification or add additional context in comments.

7 Comments

Ah, yeah i tried double slashes too. So I can't open a directory like local vim at all? Is there any way to do it? Plugin or some other work around?
You can try sftp, which works fine for directories: vim sftp://user@host//home/user/project/
Getting much closer! vim sftp://user@host//home/user/project/foo.txt actually opens the file! Yay! However, if I remove foo.txt and try just /project or /project/ as the end of the URL it opens the file explorer but shows no files. Is them some trick to that I'm missing?
just tried on my set up and it works for me well even with folders. You can validate with the sftp command directly, if it works for you (for example, if there is not some chroot on your server for sftp or some other difference?)
Well, for a pure sftp call I call sftp user@host:project/ because /home/user/ is auto prepended to that URL. However, calling sftp user@host:project/ works fine and if I do ls I can see all the files.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.