Created
June 2, 2017 20:07
-
-
Save rufo/33e23e64028274b70ee594cfdd7827fc to your computer and use it in GitHub Desktop.
Change vim settings settings based on power status
This file contains 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
" requires vim 8 for timer support | |
function! UpdatePowerSaving(timerId) | |
if executable('pmset') | |
call system("pmset -g batt | head -1 | grep 'Battery'") | |
if !v:shell_error | |
" on battery | |
let g:ale_lint_delay=10000 | |
else | |
" power adapter | |
let g:ale_lint_delay=200 | |
endif | |
endif | |
endfunction | |
call UpdatePowerSaving(0) | |
let powerTimer=timer_start(10000, "UpdatePowerSaving") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment