Vim + netrw Problem

While modifying a remote file with netrw under Windows I ran into a problem upon trying to write the file.

scp -q "VIMD72e7.tmp" "host:/path/to/file.txt"
VIMD7E7.tmp: No such file or directory
shell returned 1
Hit any key to close this window...

I think that this is a result of the autochdir option being set. My fix is to do a

:lcd $TEMP

in the buffer with the remote file loaded prior to writing the file. This lets scp find the temporary file and the copy/write succeeds.

[Digg] [Reddit] [DZone]

One Comment

  1. Vitek:

    Hi I just sent a patch which should correct the behavior of netrw under M$Win to Charles Campbell Jr. I also added support for ‘pscp’ from the putty family. To make it work with ‘pscp’ , add this to your vimrc:
    let g:netrw_scp_cmd =”pscp -i C:\\private.ppk”

    The file private.ppk is private key for your connection. In the editor you have to give the user name, i.e. “:e scp://user@host/”. Well, it’s not perfect, I know …

    If you would like to find out more have a look at pscp:

    How to generate public/private key and save public key on server: http://www.tartarus.org/~simon/puttydoc/Chapter8.html#pubkey-gettingready
    8.3 Getting ready for public key authentication

    How to use private key with ‘pscp’:
    http://www.tartarus.org/~simon/puttydoc/Chapter5.html
    5.2.4 Using public key authentication with PSCP

    I hope Charles will accept my patch and release new version of netrw soon. Meanwhile you can download the patched netrw from
    http://artax.karlin.mff.cuni.cz/~gottv1am/netrw.vim.gz

    Happy vimming :-)

    Vitek

Leave a comment