Sunday, April 24, 2011

Re: edit alternate file -- e!# vs b!#

Reply to message «Re: edit alternate file -- e!# vs b!#»,
sent 18:18:38 24 April 2011, Sunday
by Tony Mechelynck:

> Don't forget that with an exclamation mark, if your current buffer (the
> one you leave to edit the alternate file) is modified, and not open in
> another window, all changes will be lost with no warning.
You forgot to add `unless you have set one of 'hidden', 'autowrite',
'autowriteall' options'. I do not know why one may want not to set `hidden'
option.

Original message:
> On 24/04/11 02:41, Bee wrote:
> > On Apr 23, 5:00 pm, Tim Chase<v...@tim.thechases.com> wrote:
> >> On 04/23/2011 11:54 AM, Bee wrote:
> >>> To edit the alternate file, is there any difference between these:
> >>>
> >>> nnoremap ,g :e!#<cr>
> >>>
> >>> nnoremap ,g :b!#<cr>
> >>
> >> While there may be other differences, you can edit unnamed
> >> buffers with ":b!#" while ":e!#" requires that the file exist.
> >> Additionally, if the file on-disk has changed, using e! will
> >> prompt about a reload while b! will simply jump to the unedited
> >> buffer.
> >>
> >> Those are a few differences I sussed out by poking at the edges
> >> of the two commands.
> >>
> >> -tim
> >
> > Thank you Tim
> >
> > After doing some tests ":b!#" is the one I like.
> >
> > It is useful when editing source code, then adding a mapping or
> > function to vimrc with a vim help file open.
> >
> > With the vimrc and help open I can toggle back and forth.
> >
> > When done ":bn" or ":bp" will take me thru my source files skipping
> > the "unlisted"/help files.
> >
> > -Bill
>
> Don't forget that with an exclamation mark, if your current buffer (the
> one you leave to edit the alternate file) is modified, and not open in
> another window, all changes will be lost with no warning.
>
> Best regards,
> Tony.

No comments: