title: How can I change the color of my statusline depending on whether the current buffer has been modified?
body: <p>I'm new to Vim and I want to set the color for a portion of my statusline, depending on whether the buffer has been modified or not. I have the following in my <code>.vimrc</code>:</p>
  <pre><code>set statusline=%{&amp;modified=='nomodified'?'%#User1#':'%#User2#'}
  &quot; restore normal highlight
  set statusline+=\ %*
  </code></pre>
  <p>And in my colorscheme, I have the following:</p>
  <pre><code> hi User1 gui=NONE guifg=#000000 guibg=#FFFFFF
   hi User2 gui=NONE guifg=#000000 guibg=#FF0000
  </code></pre>
  <p>This only adds the messages %#User1# and %#User2# in my statusline, depending on whether the current buffer has been modified or not; it does not change the color of the statusline.</p>
  <p>Is there a way to change the color of the statusline with a simple if/else statement, like the one I described above?</p>