Ok guys, maybe this one has been asked before, but I searched and ran threw nothing, so i'm taking a chance here.
I'm using the latest vim (gvim 7.3), on Windows 7 64bits.
I've got some remote files that I want to edit directly with vim, using netrw.
Right now, I've got a fully working transparent ssh connexion to my remote hosts, thanks to Putty, Pageant and public/private keys.
I've successfully setup a read/write access to distant files with those fixes:
#### .vimrc ####
let g:netrw_cygwin= 0
let g:netrw_scp_cmd = 'c:\"Program Files (x86)"\PuTTY\pscp.exe -q -batch'
let g:netrw_sftp_cmd= '"c:\"Program Files (x86)"\PuTTY\psftp.exe'
Then I can access a file with :
:e scp:\\user@host:port\\home\me\some-file.txt
And, each time I access remote file, Vim run a windows prompt (cmd.exe) :
C:\Windows\system32\cmd.exe /c c:\"Program Files (x86)"\PuTTY\pscp.exe -q -batch
-P 22 "C:\Users\me\AppData\Local\Temp\VIF215E.tmp" "user@host:/home/me/some-file.txt"
Hit any key to close this window...
My problem is that hitting a key outside Vim each time I want to open/write a file isn't efficient at all.
So my question(s) is(are) :
Thanks a lot and happy vimming.
EDIT: Note to the myself in the past: Dude, just go with linux and vanilla gvim/ssh. You'll thank me later (and take a look at spf13-vim)
These are what I got working today (gVim 7.3 in Win 7) (took me many hours to finally get something working):
set nocompatible
let g:netrw_cygwin = 0
let g:netrw_list_cmd = "plink.exe -P ##### -pw MyPass [email protected] ls -Fa "
let g:netrw_ssh_cmd = "plink -T -ssh"
let g:netrw_scp_cmd = "pscp -P ##### -pw MyPass -scp"
let g:netrw_sftp_cmd = "pscp -pw MyPass -sftp"
or
let g:netrw_sftp_cmd = "psftp -P ##### -pw MyPass [email protected]"
With the first command make sure there's a [space] after -Fa or you'll get errors. Then you can connect in Vim via
:e scp://user@host:port#/(path to file)
:e sftp://user@host:port#/(path to file)
I hope this helps some Vimmers struggling to figure this out and get it working. Cheers!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With