Saturday, April 30, 2011

Re: How to get undo functionality after :bnext

On 04/30/2011 05:33 PM, reckoner wrote:
> On 4/29/2011 1:51 PM, Tim Chase wrote:
>> On 04/29/2011 03:47 PM, Reckoner wrote:
>>> When editing multiple buffers, I do :bnext to get to the
>>> next buffer. Unfortunately, when I return to that buffer
>>> or one of the previously edited buffers, I can no longer
>>> "undo" the changes in the corresponding buffer.
>>>
>>> Is there a way to set it up so that even if I do :bnext
>>> that I can still undo changes when I return to the same
>>> buffer?
>>
>> :set hidden
>>
>> :help 'hidden'
>
> Thanks for your response, but I'm going to need a bigger hint
> than that. That section of the manual is not very well
> written. I'm not having much luck understanding it.

[reordering and trimming as advised in the footer of each message
that comes from the list...top-posting is discouraged]

If you add the line

set hidden

to your local vimrc, it will turn this on globally. This allows
you to leave a buffer (such as with ":bnext", ":enew", ":n", etc)
while maintaining your undo/marks, etc. When you return to that
buffer, you retain all those marks and undo-ability. It also
doesn't force you to write the file or abandon the changes (which
it would do otherwise with the default "set nohidden").

-tim


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

Post a Comment