title: Vim Highlight Setting Local
body: <p>I want to ask if it is possible to define highlighting local to a buffer/window, as well as with any other vim option. So far I've this small group in my <code>.vimrc</code>, to "highlight" the active window. Therefore only the active window gets the cursorline.</p>
  
  <pre><code>augroup CursorLine
    autocmd!
    autocmd WinEnter * set cursorline
    autocmd WinLeave * set nocursorline
  augroup END
  </code></pre>
  
  <p>Now I want to do something similar with the background. A pure black for inactive windows and a really dark grey for the active one. My approach is this:</p>
  
  <pre><code>augroup BackgroundSwitch
    autocmd!
    autocmd WinEnter * highlight Normal ctermbg=235 ctermfg=15  guibg=#ff0000 guifg=#FFFFFF cterm=NONE  gui=NONE
    autocmd WinLeave * highlight Normal ctermbg=16  ctermfg=15  guibg=#ff0000 guifg=#FFFFFF cterm=NONE  gui=NONE
  augroup END
  </code></pre>
  
  <p>Unfortunately this always make all window backgrounds like the active one. I guess WinLeave is thrown before WinEnter, so it is only rly shortly visible (not for me). An setting a highlight instead of an options, affects always all windows in this <em>Vim</em> instance.<br>
  So is there the possibility, that this highlights are only set locally, so I get the wished behaviour?<br>
  Thanks!</p>