Skip to content

Show battery information on statusline/tabline of Neovim/Vim

License

Notifications You must be signed in to change notification settings

xu3s/battery.vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

battery.vim

Version 0.2.0 Support Neovim 0.2.0 or above Support Vim 8.0.0027 or above MIT License Doc Powered by vital.vim

battery.vim in tabline

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.

See also

About

Show battery information on statusline/tabline of Neovim/Vim

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Vim Script 100.0%