We can specify expressions inside the statusline/tabline syntax using
%!..., does anyone know how to get the buffer number inside a function provided to that? Standard means of using
bufnr() returns the buffer the cursor is on. Here is a minimal example:
vim.o.statusline = '%!bufnr()'
Then open up two separate buffers in splits and jump between them, the statusline will not show the buffer number tied to the statusline for a specific window, rather all the statuslines will show the same buffer number (whichever your cursor is in).