Wikia

Vim Tips Wiki

Changes: Using PuTTY pscp with Vim

Edit

Back to page

(Not clear.)
 
Line 12: Line 12:
 
|category2=
 
|category2=
 
}}
 
}}
OK GOod,
 
 
 
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!
 
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!
   
Line 19: Line 17:
   
 
Add to your vimrc:
 
Add to your vimrc:
<code>
+
 
<pre>
 
<pre>
 
" paj using PSCP on Windows. Works best with Pageant.
 
" paj using PSCP on Windows. Works best with Pageant.
Line 27: Line 25:
 
C:\>vim -d \path\to\vimfiles\colors\primitive.vim scp://user@my.host/path/to/.vim/colors/primitive.vim
 
C:\>vim -d \path\to\vimfiles\colors\primitive.vim scp://user@my.host/path/to/.vim/colors/primitive.vim
 
</pre>
 
</pre>
</code>
+
 
==References==
 
==References==
 
*{{help|scp}}
 
*{{help|scp}}

Latest revision as of 07:35, July 21, 2012

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

ReferencesEdit

CommentsEdit

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?


Around Wikia's network

Random Wiki