1

I ran :ls! (having only a vague memory of the command and not really knowing what I was going to see) and saw a short list of files (maybe 5 or 6) with 'u' in the gutter. Apart from one of the files, all were from months or years ago.

I understand the 'u' means they are 'unloaded' buffers. Somewhere I read you can get rid of them with :bwipeout. So I did that. They disappeared from :ls!.

However, shortly after, another file appeared in the :ls! list with 'u' in the gutter; a file I think I closed normally. However, other files I've been editing and closing normally like the latter did not appear in the list.

What's going on? Why did this file, in no way different from other files I've been editing, appear in the :ls! list and others not?

And why are buffers in vim so extraordinarily convoluted? Is there a post anywhere that is able to explain buffers in a short, sweet way?

1
  • u is for unlisted buffers, not unloaded
    – Maxim Kim
    Dec 27, 2023 at 0:22

1 Answer 1

1

I would go for :h :ls for an explanation.

In short, :ls! shows also unlisted buffers (:h unlisted-buffers) also available as a link from :h :ls:

                                                *unlisted-buffer*
unlisted        The buffer is not in the buffer list.  It is not used for
                normal editing, but to show a help file, remember a file name
                or marks.  The ":bdelete" command will also set this option,
                thus it doesn't completely delete the buffer.  Settings: >
                        :setlocal nobuflisted

If you are sure that buffers you see there were wiped out, not deleted, then I would think of a plugin that set nobuflisted for the buffer(s).

8
  • So under what circumstances would a file appear in :ls! command upon opening a new gvim window? For example, I have been editing, writing, and quitting various files this morning. I have just opened a new gvim window. The :ls command lists just one buffer, [No Name]. Yet :ls! lists an additional buffer, a file that was one of the many files I edited today. In the margin it says, 2u. I don't believe this file is in any way particularly different from any of the other files I edited today.
    – Tom
    Dec 27, 2023 at 3:16
  • Maybe you had set a global mark?
    – Maxim Kim
    Dec 27, 2023 at 3:28
  • I have a mapping to bunload a buffer. It appears this makes a buffer appear in :ls! commands upon new gvim starts. But only to a maximum of two unlisted buffers. Each new bunloaded buffers overwrites older in the latter list. Is this how it's supposed to work? It seems, slightly (ahem) insane.
    – Tom
    Dec 27, 2023 at 3:29
  • > Maybe you had set a global mark? – Maxim Kim I don't think so. Are you saying that creating a global mark in a file would make it appear in :ls! command for entirely new gvim window?
    – Tom
    Dec 27, 2023 at 3:30
  • well, in my case I don't see any of the unlisted buffers when I start a new gvim. No matter if I :bunload it or not. Does it happen if you start vim without user configuration? vim -Nu NONE
    – Maxim Kim
    Dec 27, 2023 at 3:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.