2

I can list buffers with :ls and see their load state. I can load all the buffers using :bufdo e and a specific buffer using a range, for instance to load only buffer 2 :2bufdo e, however this makes buffer 2 the current file, that is I can now see it. Is there a command I can use to ensure a buffer is loaded but not make it current?

For a bit of background see vim-orgmode issue

2
  • Welcome to Vi and Vim! Can you explain why you need a buffer to be loaded? Whenever you need access to the buffer, Vim would load it at that point anyways... I can't really see why one would need to preload a buffer... Can you expand on that? It's easier to switch to a buffer with :b 2, why not just do that? Can you use :e # to switch back to the file you were editing after loading buffer 2? – filbranden Aug 29 '20 at 17:20
  • Also, in the vim-orgmode issue, you mention args and :argdo, so is this actually about args that haven't been loaded into buffers yet? Or do you really see them in :ls output, but without the flag showing it's loaded? – filbranden Aug 29 '20 at 17:27
1

You want bufload() and maybe bufadd().

Usage example:

call bufadd('someName')->bufload()

The patch 8.1.1610 is required.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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