projects
/
vimconf.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
1b13e6b
)
macros: Fix OnBattery()
author
Stefan Huber <shuber@sthu.org>
Sat, 18 Apr 2020 22:01:29 +0000
(
00:01
+0200)
committer
Stefan Huber <shuber@sthu.org>
Sat, 18 Apr 2020 22:01:29 +0000
(
00:01
+0200)
Avoid reading /sys file if not existent.
macros.vim
patch
|
blob
|
history
diff --git
a/macros.vim
b/macros.vim
index 58599670c737d4e4f01f920551b31a873f571155..046e381283aef870c7ebc0b50008867ff8551ecd 100644
(file)
--- a/
macros.vim
+++ b/
macros.vim
@@
-119,7
+119,9
@@
function OnBattery()
if has('macunix')
return match(system('pmset -g batt'), "Now drawing from 'Battery Power'") != -1
elseif has('unix')
- return readfile('/sys/class/power_supply/AC/online') == ['0']
+ if filereadable('/sys/class/power_supply/AC/online')
+ return readfile('/sys/class/power_supply/AC/online') == ['0']
+ endif
endif
return 0
endfunction