+function OnBattery()
+ if has('macunix')
+ return match(system('pmset -g batt'), "Now drawing from 'Battery Power'") != -1
+ elseif has('unix')
+ if filereadable('/sys/class/power_supply/AC/online')
+ return readfile('/sys/class/power_supply/AC/online') == ['0']
+ endif
+ endif
+ return 0
+endfunction
+
+