Sunday, April 24, 2011

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

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.
--
What good is having someone who can walk on water if you don't follow
in his footsteps?

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

No comments: