Skip to content

Instantly share code, notes, and snippets.

@AndrewVos

AndrewVos/.vimrc Secret

Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndrewVos/46330853aaadca31f717 to your computer and use it in GitHub Desktop.
Save AndrewVos/46330853aaadca31f717 to your computer and use it in GitHub Desktop.
function! AdjustToLight()
let lightFile = "/sys/devices/platform/applesmc.768/light"
for line in readfile(lightFile, '', 1)
let line = substitute(line, '[()]', '', '')
let parts = split(line, ',')
let light = parts[0]
if light > 150
if g:colors_name != "Tomorrow"
silent! colorscheme Tomorrow
endif
else
if g:colors_name != "Tomorrow-Night"
silent! colorscheme Tomorrow-Night
endif
endif
endfor
endfunction
augroup Light
autocmd!
autocmd CursorHold,CursorHoldI,CursorMoved,CursorMovedI * call AdjustToLight()
augroup END

AdjustToLight

Adjust your vim color scheme to a light one when it's bright outside! This only works if your running Linux on your Macbook, I think.

Install this:

https://github.com/chriskempson/vim-tomorrow-theme

Then place the above code in your .vimrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment