Number of Windows in VIM
You could also do the following:
let window_counter = 0
windo let window_counter = window_counter + 1
echo window_counter
The :windo
command runs an ex command in each window of your current tab.
I'm guessing you can do it all with the winnr() command.
winnr() by itself tells you the window number you are currently in. winnr('$') tells you the last window (or window count)
The following would return '1' if you were in the last window, and 0 otherwise:
echo winnr() == winnr('$')
Taking your example you could then do something like this to execute something only on the last window:
:autocmd WinEnter * if winnr() == winnr('$')|echo "Welcome to the last window"|endif