Vim Tips Wiki

Using PuTTY pscp with Vim

1,610pages on
this wiki
Revision as of 07:35, July 21, 2012 by JohnBeckett (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Tip 1181 Printable Monobook Previous Next

created March 21, 2006 · complexity basic · author Pete Johns · version 6.0

Have you ever wished that you could compare a text file on your Windows machine with one on your FreeBSD/Redhat box? Now you can!

In addition to Vim, you'll need PSCP (which you can download from and diff.exe. If you are using Pageant you will not even have to worry about passwords.

Add to your vimrc:

" paj using PSCP on Windows. Works best with Pageant.
if ($OS =~ "Windows")
  let g:netrw_scp_cmd="\"c:\\Program Files\\PuTTY\\pscp.exe\" -q -batch"
C:\>vim -d \path\to\vimfiles\colors\primitive.vim scp://



This doesn't seem to work for me because pscp seems to put the remote host '' in single quotes. Then the command line fails.

Is there any way to force netrw not to use single quotes in the command line?

Looks like the single quotes is added only in vim 7.0, when I switched back to 6.2 it works.

There's a hack I found on Google which makes pscp work with Vim 7:

In the netrw.vim file (normally vim70/autoload/netrw.vim), search for the following line (normally line 557) and remove single quotes:

exe g:netrw_silentxfer."!".g:netrw_scp_cmd.useport." '".g:netrw_machine.":".escape(b:netrw_fname,g:netrw_fname_escape)."' ".tmpfile

Has this been fixed in the current netrw?

Around Wikia's network

Random Wiki