Awesome
battery.vim
battery.vim is a statusline
or tabline
component for Neovim/Vim.
It uses a job feature of Neovim/Vim to retrieve battery informations so that the plugin won't block the main thread.
It supports macOS, Windows, and Linux.
The implementation was translated to Vim script from a Bash script found on https://github.com/b4b4r07/dotfiles/blob/master/bin/battery.
Install
Use junegunn/vim-plug or Shougo/dein.vim like:
" Plug.vim
Plug 'lambdalisue/battery.vim'
" dein.vim
call dein#add('lambdalisue/battery.vim')
Or copy contents of the repository into your runtimepath manually.
Usage
Use battery#component()
like:
set statusline=...%{battery#component()}...
set tabline=...%{battery#component()}...
Or with itchyny/lightline.vim
let g:lightline = {
\ ...
\ 'component_function': {
\ ...
\ 'battery': 'battery#component',
\ ...
\ },
\ ...
\}
Additionally, assign 1 to corresponding variables to immediately reflect the
changes to statusline
or tabline
.
let g:battery#update_tabline = 1 " For tabline.
let g:battery#update_statusline = 1 " For statusline.