Skip to content

Instantly share code, notes, and snippets.

@snoblenet snoblenet/warn.vim
Last active May 5, 2017

Embed
What would you like to do?
Caps Lock and Insert mode warning for Vim
" 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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.