Sunday, December 11, 2016

Re: Moving a file

On Sun, Dec 11, 2016 at 06:17:59PM +0300, Nikolay Aleksandrovich Pavlov wrote:
> 2016-12-11 16:45 GMT+03:00 Nikolay Aleksandrovich Pavlov <zyx.vim@gmail.com>:
> > 2016-12-11 15:53 GMT+03:00 Michael Henry <vim@drmikehenry.com>:
> >> On 12/10/2016 04:07 PM, shawn wilson wrote:
> >>> How do I change which file a buffer is pointing to so that I
> >>> can do a simple :w and get notified if an external app updates
> >>> it, etc?
> >>
> >> If I'm understanding your question, you're looking for ``:saveas
> >> newfilename``. This will both save the file and associate
> >> newfilename with the buffer; from this point on, it will behave
> >> the same as if you'd started Vim with ``vim newfilename``.
> >
> > No, not at all. It will create a *new* buffer associated with the new
> > file name and save the file. Old buffer is also preserved with the old
> > file name. Help is incorrect on the matter. Associating current buffer
> > with the different name is done with :file command, though it will not
> > write to a file (need explicit :write or something like this).
>
> Though no, :saveas is something more weird: it *does* rename a buffer
> unlike what I said earlier, but it also creates a new buffer with
> *old* name.

It does seem to me that :saveas or :file will possibly answer the
original question, but... what *is* the original question?

Shawn, what is it you're trying to do, exactly? The two parts of your
question ("changing which file a buffer points to" and "get notified
when a file is externally modified") are unrelated in vim.

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