Skip to content

v1.1.1

Latest

Choose a tag to compare

@justinhj justinhj released this 11 Oct 04:15
· 2 commits to main since this release

battery.nvim v1.1.1

Note

v1.1.1 is the first published release since v1.0.0. It includes everything tagged in v1.1.0, plus a small documentation fix.

This release adds low battery notifications. It also removes the plenary dependency and the extra Linux/WSL code paths, and puts all modules and types under the battery namespace.

Warning

Breaking changes. Read the "Breaking changes" section if your config uses require('util.*'), the plugin's LuaLS types, or the acpi / wsl parsers.

✨ New features

Low battery notifications (#77)

battery.nvim can now warn you when your battery runs low. The check only runs while on battery power. You get one notification each time a threshold is crossed. Plugging in, or charging back above a threshold, resets it.

require('battery').setup({
  notify_on_low_battery = true,     -- default: false
  low_battery_threshold = 20,       -- WARN level
  critical_battery_threshold = 10,  -- ERROR level
  notify_function = nil,            -- optional fun(msg, level), defaults to vim.notify
})
  • Use notify_function to send notifications to something else, such as nvim-notify.
  • If critical_battery_threshold is not a number lower than low_battery_threshold, setup() shows a warning and turns notifications off.

Developer shell scripts (#68)

New scripts start a minimal, consistent Neovim for working on the plugin:

  • scripts/dev-shell.sh (Linux/macOS) and scripts/DevShell.ps1 (Windows)
  • nvim -u ./scripts/dev_init.lua loads the plugin, runs setup(), and adds the helpers BatteryStatus() and BatteryStatusLine().

💥 Breaking changes

Modules and types are namespaced (#64)

  • The util module is now battery.util. Update any require('util.log'), require('util.timers'), etc. to require('battery.util.log') and so on.

  • LuaLS type annotations now have a battery. prefix so they don't clash with other plugins:

    Old New
    BatteryStatus battery.Status
    Config battery.Config
    IconSet battery.IconSet
    ParserModule battery.ParserModule
    MultipleBatterySelection battery.MultipleBatterySelection

acpi parser removed (#76)

On Linux, battery info now comes only from /sys/class/power_supply. You no longer need the acpi package.

WSL parser removed (#71)

The WSL parser (cmd.exe /c powercfg.exe) is gone because it is no longer needed. WSL is still listed as supported, and it now uses the standard detection.

🔧 Improvements

  • plenary.nvim removed (#63). Background jobs now use the built-in vim.system. A simple logger utility was added, and the test suite runs with plain Lua assertions. The plugin and its tests no longer need anything outside Neovim.
  • nvim-web-devicons is no longer a documented dependency. The install snippets for Plug, lazy.nvim and Packer no longer list it.
  • Code formatting cleanup (tabs changed to spaces, consistent string concatenation).

📚 Documentation

  • README rewritten, with deprecated content removed (#65, #70).
  • New install instructions for Neovim's built-in vim.pack (#70).
  • New "Development" section in the README, and updates to CONTRIBUTING.md (#68).
  • doc/battery.txt covers the new notification options.
  • Typo fixes ("diconnected" → "disconnected", and others).
  • Removed a duplicate multiple_battery_selection line and an outdated acpi reference from the configuration example in the README and doc/battery.txt (v1.1.1).

📄 License

  • Now labelled MIT License (Expat), copyright 2022–2026 Justin Heyes-Jones and Contributors (#66).

Requirements

  • Neovim v0.10.0+ (unchanged)

Full changelog: v1.0.0...v1.1.1