Last active
May 5, 2017 04:08
-
-
Save snoblenet/87ac44249709083032931aa94d46d334 to your computer and use it in GitHub Desktop.
Caps Lock and Insert mode warning for Vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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