5

Is there any way to restore an unlisted buffer in Vim and send it back to the list of buffers?

For example:

:ls!
  1# "one.txt"
  2% "two.txt"
  3u "three.txt"

Can I send the third buffer back to the list?

:ls
  1# "one.txt"
  2% "two.txt"
  3  "three.txt"
4

Switch to your unlisted buffer and reset the 'buflisted' option:

:buf 3
:set buflisted
1
  • :b3 alone was enough for me; that automatically brought that file back to the listed buffers. – elquimista Oct 17 '18 at 8:45
0

Or, another way:

:badd three.txt
0

Open unlisted buffer and edit it:

:b3
:e

Or in one line:

:b3|e

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.