Loading ...
Sorry, an error occurred while loading the content.
 

Help could be clearer on when buffers get hidden instead of abandoned

Expand Messages
  • Ben Fritz
    ... From this, I have understood for a long time (wrongly) that :buffer! 2 on a modified buffer 1 will discard the changes to the buffer. I learned from a
    Message 1 of 1 , Jul 29, 2013
      > *abandon*
      > Vim remembers whether you have changed the buffer. You are protected from
      > losing the changes you made. If you try to quit without writing, or want to
      > start editing another file, Vim will refuse this. In order to overrule this
      > protection, add a '!' to the command. The changes will then be lost. For
      > example: ":q" will not work if the buffer was changed, but ":q!" will.

      From this, I have understood for a long time (wrongly) that ":buffer! 2" on a modified buffer 1 will discard the changes to the buffer.

      I learned from a recent update to http://vim.wikia.com/wiki/Easier_buffer_switching that this is actually not correct. When forcing the :buffer command, a modified buffer becomes hidden, not unloaded.

      I'm not 100% clear on which commands will abandon the changes. The best I see is in :help :buffer-! and :help 'hidden' which just say "commands that move through the buffer list". So I guess it's just the commands in the "buffer list" column in the table under :help buffer-list?

      Anyway, I think :help abandon could be clearer by changing the last two sentences I quote above:

      > In order to overrule this protection, add a '!' to the command. With most
      > commands, the changes will then be lost. But when moving through the buffer
      > list the buffer is hidden instead. For example: ":q" will not work if the
      > buffer was changed, but ":q!" will close the buffer and abandon the changes.
      > ":bnext!" on the other hand will hide the buffer but keep the changes.

      Is there a good reference to give in these three help locations for a list of commands that "move through the buffer list"?

      --
      --
      You received this message from the "vim_dev" 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_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    Your message has been successfully submitted and would be delivered to recipients shortly.