title: showing battery usage in VIM statusbar
body: <p>I have a Macbook 10.7. 
  I always maximize the terminal window so if I wanna check the battery status i have to move the mouse to the top or quit the maximum vim window.
  So I would like to show the battery in the vim statusbar.
  Here is what I did:
  Create a file and make it executable.</p>
  
  <pre><code>vi /bin/battery
  
  #!/bin/bash
  ioreg -l|grep -i capacity | tr '\n' ' | '|awk '{printf("%.1f%%", $10/$5 * 100)}'
  </code></pre>
  
  <p>Now if I type "battery" in terminal it will output something like 87.6%.
  My question is how am I supposed to show this thing in VIM status bar?</p>
  
  <p><strong>OK! Thanks for Romainl and Ingo's help. after reading and testing i think i get a 'perfect' solution. at least i am satified. :P</strong></p>
  
  <p>Here is the detail.</p>
  
  <pre><code>sudo vi /bin/battery
  
  #!/bin/bash
  /usr/sbin/ioreg -l|grep -i capacity|tr '\n' ' | '|awk '{printf("%d%%",$10/$5*100)}'&gt;~/.battery
  
  crontab -e
  #check battery every 4 mins.
  */4 * * * * /bin/battery
  </code></pre>
  
  <p>the battery script outputs to a file. and it runs every 4 mins(controlled by crontab).
  the rest part is about the same as Ingo's answer.</p>
  
  <pre><code>:let g:battery = '???'
  :autocmd CursorHold * let g:battery = system('cat ~/.battery')
  :set statusline+=%{g:battery}
  </code></pre>