Vim Tips Wiki
Register
Advertisement
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 http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html) 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"
endif
C:\>vim -d \path\to\vimfiles\colors\primitive.vim scp://user@my.host/path/to/.vim/colors/primitive.vim

References[]

Comments[]

This doesn't seem to work for me because pscp seems to put the remote host 'foo@bar.com:/dir' 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

 TO DO 
Has this been fixed in the current netrw?


Advertisement