Monday, October 5, 2015

Re: How to copy and rename a file with netrw where the target and source directory are the same?

Shane Dev wrote:
>> Copy a file using the usual netrw method for copying: (assuming cursor
>> is atop the file to be copied, and that the file is a file, not a director)
>>
>> mt (mark target)
>> mf (mark file)
>> mc
>>
>> You'll be given a prompt: Copy [filename] to : [filename]
>>
>> Just edit the 2nd instance of [filename] to whatever you want, then hit
>> <cr>.
>>
>> Regards,
>> Chip Campbell
> Hi Chip,
>
> When do this, I get an error window with
> **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!;
>
> I am using vim 7.4
>
Netrw depends on the o/s to do a lot of things, including copying
files. In this case, it is trying to use the "cp" command and its
failing when a system() call is taken...

call system(g:netrw_localcopycmd." ".shellescape(fname)."
".shellescape(topath))

fname will hold the file's name that's to be copied, and
topath holds the target directory (and filename).

or an isexecutable(g:netrw_localcopycmd) indicates the command is not
executable.

Translated: put whatever your system uses for copying files as a command
and enter it into g:netrw_localcopycmd. You may wish to modify the
other, related variables, too:
g:netrw_localmovecmd, g:netrw_localcopydircmd, g:netrw_localrmdir, etc.

If you're using windows, you ought to upgrade netrw (see
http://www.drchip.org/astronaut/vim/index.html#NETRW) because it has an
improved way to get windows to do what's wanted (fyi: using $COMSPEC).

Regards,
Chip Campbell

--
--
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: