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


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!
    – job_start
    Jan 4 at 8:59
  • I just asked another one as relating to my next step, could you help me too?
    – job_start
    Jan 4 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
    Jan 4 at 9:29

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.