I want vim to open Tagbar with
:TagbarToggle when vim is starting up, but only:
- If the file is Python
- If it's not vimdiff
- If I'm not using
vim -O file1.py file2.pyto open multiple windows
I would expect this to work:
if ! &diff && winnr('$') == 1 autocmd FileType python :TagbarToggle endif
:echo winnr('$') in vim does show the number of windows currently open, but adding
echo winnr('$') to vimrc always returns 1, even if multiple windows are being opened with
Is there a different way to check in vimrc if multiple windows are being opened?
I'm pretty sure I can hack together a solution based on timers (
timer_start), where it waits for vim to open a hard-coded amount of time before checking
winnr('$'), but that seems dumb. On slower systems, like a raspberry pi (which I use), the hardcoded value would need to be longer to adjust for longer startup time, but a longer timer on a faster system would be noticeable (the files would open, and half a second later, tagbar would open, which is annoying).