Thursday, October 8, 2015

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

Shane Dev wrote:
> Hi Chris,
>
> :cd [the directory of oldfilename]
> :call system("cp 'oldfilename' 'newfilename'")
>
> works as expected.
>
> After further testing, it seems I have to execute netrw-c (make browsing directory the current directory) before the sequence -
>
> 1. move cursor to oldfile,
> 2. mt
> 3. mf
> 4. mc
> 5. enter newfilename.
>
> If I execute :cd (change to home directory) and repeat the above sequence, then I get -
>
> **error** (netrw) tried using g:netrw_localcopycmd<cp>; it doesn't work!
>
> Is this part of netrw design?
>
Yes; you can change the current directory behavior by setting
g:netrw_keepdir= 0 in your .vimrc.

Vim v6.x's Explorer always kept the vim current directory separate from
its browing directory -- netrw supports backwards compatability by also
doing so, by default; however, it lets you change that behavior. I,
personally, prefer to have netrw's browsing directory and vim's current
directory be the same, myself.

Glad you found the problem, though.

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:

Post a Comment