" updated as a side-effect.
map Qs :filetype detect<CR>:<CR>
-endif
-
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Handle options only available in Vim 7 and above.
-""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-if version >= "700"
-version 7.0
-
-" Change status bar colour when entering insert mode.
+" Change status bar colour when various things happen.
fun! Highlight_StatusLine(flag)
" Get current status.
call Iain_Vars()
exec "highlight StatusLine guifg=white guibg=" . s:colour . " ctermbg=white ctermfg=" . s:termcolour
endfun
+call Highlight_StatusLine("")
+endif
+
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+" Handle options only available in Vim 7 and above.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+if version >= "700"
+version 7.0
+
au CursorHoldI * call Highlight_StatusLine("H")
au CursorMovedI * call Highlight_StatusLine("h")
au FocusGained * call Highlight_StatusLine("F")
au FocusLost * call Highlight_StatusLine("f")
au InsertEnter * call Highlight_StatusLine("I")
au InsertLeave * call Highlight_StatusLine("i")
-call Highlight_StatusLine("")
" Make diffs vertical by default.
se diffopt+=vertical