As title. I want to detect the case when there is only one split in the current tab.

1 Answer 1


Start with:

echo tabpagewinnr(tabpagenr(), '$')

tabpagenr() gives you the number of the current tab page.

Use '$' as the second param to tabpagewinnr() and that function will return the number of windows contained in the specified tab page.

So you can test for single window (no splits) with something like:

if tabpagewinnr(tabpagenr(), '$') == 1
    " do something
  • This is cool! Let me try it! Commented Jan 4, 2022 at 8:59
  • I just asked another one as relating to my next step, could you help me too? Commented Jan 4, 2022 at 9:04
  • I answered with the first thing that occurred to me. If I had more time I might find something that just uses function calls but I'm a little short on time right now.
    – B Layer
    Commented Jan 4, 2022 at 9:29

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.