Is there an option to apply a setting in all tabs and windows, e.g. apply
:set number to all open tabs?
:tabdo windo set number gets the job done, but I don't really like it since it actually switches to each tab and window before running the command. After it finishes running, you'll end up on the last window of the last tab.
I think this is a cleaner way to set options in all windows without changing the current tab and window:
function! s:set_all(option, val, ...) abort let val = eval(a:val) for t in range(1, tabpagenr('$')) for w in range(1, tabpagewinnr(t, '$')) if gettabwinvar(t, w, '&buftype') !=# '' continue endif call settabwinvar(t, w, '&'.a:option, val) endfor endfor endfunction command! -complete=option -nargs=+ SetAll call s:set_all(<f-args>)
:SetAll number 1 will enable the number column in all windows, except for the ones that have
buftype set, such as help windows.
This is the same as running:
:tabdo windo let &number = 1. So, the second argument needs to be an assignable expression. Instead of
:set filetype=ini, it would be
:SetAll filetype "ini".