Friday, September 7, 2018

Re: Opening remote file with scp and netrw on Windows 7

On 07/09/18, Oliver Graute wrote:
> On 03/09/18, lessthanideal wrote:
> > On Tuesday, 28 August 2018 20:22:15 UTC+1, Oliver Graute wrote:
> > > I tried to open a remote file in Vim with this command:
> > >
> > > :e scp://root@192.168.1.229:2222//home/root/output.log
> > >
> > > on Linux this is working fine. But on Windows 7 just a command line
> > > window is opening with this Error message:
> > >
> > > C:\Windows\system32\cmd.exe -c "pscp -q -P 2222 "root@192.168.1.229:/home/root/output.log" "C:\Users\OGR\AppData\Local\Temp\VIA3B61.log""
> > >
> > > The command "oot" is either misspelled or could not be found.
> > > shell returned 1
> > >
> > > Hit any key to close this window...
> > >
> > > I'am using vim 8.0 with netrw v156
> > > Some hints howto fix this?
> > >
> > > Best regards,
> > >
> > > Oliver
> >
> > The similar :e command works for me. I think the key difference may be my generated Windows command string includes the "/s" parameter which modifies how strings after "/c" are treated. (Run cmd /? to see details.) So your example modified to what I see looks like
> >
> > C:\Windows\system32\cmd.exe /s /c ""c:\program files (x86)\Putty\pscp.exe" -pw MyPassword -q -P 2222 "root@192.168.1.229:/home/root/output.log" "C:\Users\OGR\AppData\Local\Temp\VIA3B61.log""
> >
> > I have this in my _vimrc which I suppose is responsible
> >
> > "Fix passing quoted commands to cmd.exe
> > "http://groups.google.com/group/vim_dev/browse_thread/thread/3d1cc6cb0c0d27b3
> > if has ("win32") || has("win16")
> > set shellxquote=\"
> > set shellcmdflag=/s\ /c
> > endif
>
> ok this is fixing this error:
>
> > > The command "oot" is either misspelled or could not be found.
> > > shell returned 1
>
> now he asks at least for the password but is complaing about unexpected
> end-of-file
>
> C:\Windows\system32\cmd.exe /c pscp -q -P 2222 "root@192.168.1.229:/home/root/output.log"
> "C:\Users\OGR\AppData\Local\Temp\VIA9103.log"
> root@192.168.1.229's password:
> Fatal: Received unexpected end-of-file from server
> shell returned 1
> Hit any key to close this window...

finally fixed this issue by adding -scp flag to the pscp command.
for whatever reason I must tell pscp to use scp :-p

now this is in my vimrc

if has ("win32") || has("win64")
set shellxquote=\"
set shellcmdflag=/s\ /c
let g:netrw_scp_cmd = "pscp -scp"
endif

thx for your hints,

Oliver

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: