I am writing a vim plugin in which I need to check if the current tab the user is looking at is empty. If it is not empty, like say the user is already viewing a buffer or h
Let's assume that there are multiple windows in the tab, but all the windows' buffers are empty.
Maybe you'd like to say that this tab is NOT empty. If that's the case, we don't need to go through all the tabs. The following will work.
function! TabIsEmpty()
return winnr('$') == 1 && len(expand('%')) == 0 && line2byte(line('$') + 1) <= 2
endfunction