As title. I want to check that a buffer is not shown in any tabs. How to do so?


Buffer is called "hidden" if it's

  1. Loaded
  2. Not shown in any window
:echo bufloaded(N) && win_findbuf(N)->empty()


:echo bufexists(N) && getbufinfo(N)[0].hidden
  • Additional one: Do you know the api to do the same in Lua(for NeoVim)? While your current one is really helpful since now I really understand hidden mean and I can still use NeoVim's API to write VimScript.
    – job_start
    Jan 10 at 18:05
  • @job_start Neovim API is documented in :h api.txt. AFAIR, there's none.
    – Matt
    Jan 10 at 18:21

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.