What I'm trying to do is, when a window is closed(bw,bunload)/opened (NOT fzf, quickfix q:, buftype=nofile, etc..) resize all the other windows.
This code works but I was wondering if there was a better way or a command that I don't know of? Another option would be to build a list or dictionary and keep track of open/closed windows of visible buffers with real files (overkill?).
fu! s:WindowsHelper(...) if a:0 == 1 if a:1 =~ '\v.*Command' || a:1 =~ '\v^\s*$' || a:1 =~ 'bufferEmpty' return 0 endif endif call s:ResizeWindows() endfu! augroup WindowsStuff autocmd! au BufEnter * if bufname(winbufnr(winnr())) == '' | call s:WindowsHelper('bufferEmpty') au WinNew * call s:WindowsHelper() au BufUnload * call s:WindowsHelper(bufname(winbufnr(winnr()))) augroup end
P.S Ive crashed a few times but can't fully blame the augroup WindowsStuff yet, I'm waiting for my next crash to look at the verbose file.