aligrudi / neatvi

A small vi/ex editor for editing UTF-8 text
http://litcave.rudi.ir/
305 stars 25 forks source link

Hidden modified buffer #69

Closed lobre closed 9 months ago

lobre commented 9 months ago

I am reading the code cause I would like to know if neatvi supports hidden buffers that are in a modified state. It seems that the answer is no, but I prefer asking the question to be sure.

Nvi allows this when using bg and fg commands. I am trying to understand how buffers manipulation works in neatvi. I see there is an autowrite setting, but wondering if a hidden buffer should obviously be saved on disk?

Thanks!

aligrudi commented 9 months ago

Loric Brevet @.***> wrote:

I am reading the code cause I would like to know if neatvi supports hidden buffers that are in a modified state. It seems that the answer is no, but I prefer asking the question to be sure.

If aw is not set, you can use :e! path to open other files. The changes are kept. If you switch back, you can continue from where you left.

Ali
lobre commented 9 months ago

If aw is not set, you can use :e! path to open other files. The changes are kept. If you switch back, you can continue from where you left.

I understand, thank you for explaining this.

Do you know why this behavior is in place? Is it something inherited from the POSIX compliance? What are the reasons for not allowing to switch buffers simply with :e (without the exclamation mark) when the current buffer is modified? Curious about this.

aligrudi commented 9 months ago

Loric Brevet @.***> wrote:

Content-Transfer-Encoding: 7bit

If aw is not set, you can use :e! path to open other files. The changes are kept. If you switch back, you can continue from where you left.

I understand, thank you for explaining this.

Do you know why this behavior is in place? Is it something inherited from the POSIX compliance? What are the reasons for not allowing to switch buffers simply with :e (without the exclamation mark) when the current buffer is modified? Curious about this.

In POSIX file changes are not kept when switching between files, if I am not mistaken

By the way, I just added the writeany option, which may be what you need.

Ali
lobre commented 9 months ago

I did not know that was an option in vi. That's exactly the behavior that I want to have. Thanks a lot. Closing this issue.