I'd like to overload my tmux binding which cycles through panes to also cycle through Vim windows if the current pane happens to be running Vim.
I can detect the presence of Vim by checking the pane title, but this is not robust because vim could have been resumed via
fg and this will fail. that's fine, I can just avoid suspending vim (I am after all in tmux).
Okay, but now Tmux must know whether current pane running Vim has a single window open (in which case switch panes) or if current pane running Vim has more than one window open.
I'm positive that this can be done. The solution can be anything from straightforward to difficult and fragile.
How can I query Vim about
- how many windows are open, and
- which window index is currently focused?