FANDOM


It's handy to get a visual reminder when you enter Insert mode, and when Caps Lock is still enabled when leaving insert mode. Do this by adding the following to your `vimrc`:

" ensure you have xset in your shell
" change 'solarized' to the name of your colorscheme
" presumes that your colorscheme, like solarized, provides both dark and light modes

function! CapsWarn()
  let CapsState = system('xset -q | grep -oE "Caps Lock:   on"')
  if CapsState =~ "on"
    highlight Normal ctermbg=Red
    redraw
    sleep 100m
    colorscheme Solarized
    redraw
  endif
endfunction

autocmd InsertEnter * set background=dark | colorscheme solarized
autocmd InsertLeave * set background=light | colorscheme solarized | call CapsWarn()

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.