Skip to content

Sycorlax/micro-smartstatus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartStatus for Micro Editor

A lightweight plugin that enriches the Micro editor status bar with useful system and project information.

  • Left side – Shell type, filetype, and current filename (with Nerd Font icons).
  • Right side – Git branch & status, cursor position, battery percentage, and current time.

Replaces the default keybinding hints and empty space with clean, glanceable data.

SmartStatus screenshot

✨ Features

Left Status Bar

  • 🐚 Detects parent shell (bash, zsh, fish, nu, etc.) and displays an icon
  • 📄 Shows current filetype with matching Nerd Font icon
  • 📁 Displays the base filename (truncated path)

Right Status Bar

  • 🌱 Git branch name with dirty state indicators (+ untracked, ! modified, deleted, clean)
  • 📍 Cursor position (line:col)
  • 🔋 Battery percentage with charging/full/low icons (reads from /sys/class/power_supply/BAT*/)
  • 🕒 Current time in 24‑hour format (HH:MM)

Updates automatically on buffer changes, cursor movement, saves, and every second (for time/battery).

SmartStatus screenshot

📦 Installation

Option 1: Official Plugin Channel (after acceptance)

Once published, install directly inside Micro:

  1. Open Micro
  2. Press Ctrl+e to open the command prompt
  3. Type: > plugin install smartstatus
  4. Press Enter

Option 2: Manual Install

Clone this repository into Micro's plugin directory:

git clone https://github.com/sycorlax/micro-smartstatus.git ~/.config/micro/plug/smartstatus

Then restart Micro or run > plugin reload smartstatus.

⚙️ Configuration

The plugin uses Micro’s built‑in statusformatl and statusformatr options to control the left and right sides.

Add or modify the following lines in your ~/.config/micro/settings.json:

{
    "statusformatl": "$(smartstatus.updateLeft)",
    "statusformatr": "$(smartstatus.smartInfo)"
}
  • statusformatl – calls the plugin’s left‑side formatter (shell, filetype, filename)
  • statusformatr – calls the right‑side formatter (git, cursor, battery, time)

Note: The plugin automatically sets statusformatl when it loads, but including it in your config ensures it persists across sessions.

🔧 Customization

Change battery path

If your system uses a different battery name (e.g., BAT0 instead of BAT1), edit smartstatus.lua and modify the list inside getBattery():

for _, bat in ipairs({"BAT0", "BAT1"}) do

Modify the time format

Edit the smartInfo() function in smartstatus.lua:

table.insert(parts, "" .. os.date("%H:%M"))  -- change to "%I:%M %p" for 12‑hour

Add or change icons

All icons are defined in the SHELL_ICONS and FT_ICONS tables at the top of smartstatus.lua.
You can replace them with your preferred Nerd Font glyphs or plain text.

Tweak refresh interval

The timer runs every second by default. Adjust the 1000 value in startRefreshTimer() (milliseconds).

❓ Troubleshooting

  • Left side shows nothing?
    Ensure settings.json contains "statusformatl": "$(smartstatus.updateLeft)" and that you have a Nerd Font installed (icons may appear as boxes otherwise).

  • Right side empty or missing Git branch?
    Verify "statusformatr": "$(smartstatus.smartInfo)" is present and that you are inside a Git repository with the git command available.

  • Battery shows ? or nothing?
    Check that your battery path is correct (see Customization). Try running cat /sys/class/power_supply/BAT1/capacity in a terminal.

  • Icons appear as squares or unknown characters?
    Install a Nerd Font and configure your terminal to use it.

📜 License

MIT License – feel free to use, modify, and share.


This updated README now matches the plugin’s actual behavior and provides complete configuration instructions.

About

Displays Git branch, battery percentage, and current time in the Micro editor status bar

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages