tpane
tpane lets you improve your tmux.conf by moving most of your configuration to Lua. It ships with widgets and a plugin system: use widgets to improve your navbar, and plugins to improve your workflow.
Demo
https://github.com/user-attachments/assets/2e92141d-1e6e-407e-903e-29453cbf95ff
Quick start
Install tpane:
|
Add this as the last line of ~/.config/tmux/tmux.conf:
run-shell -b 'tpane'
Create ~/.config/tmux/tpane/init.lua:
tpane.
tpane.
tpane.
tpane.
tpane.. = true
tpane.. = 5000
tpane.. = "vi"
tpane.
tpane.
tpane.
tpane.
local battery = tpane..
tpane.
Install
From crates.io:
Or install the latest GitHub release:
|
From source:
Minimal tmux.conf
Only a few settings are necessary to live in tmux.conf file. These are the settings that are good to start with tmux, and tpane will have the runtime config:
set -g default-terminal "xterm-256color"
set -as terminal-features ",xterm-256color:RGB"
set -g base-index 1
set -g pane-base-index 1
set -g status-position top
set -g status-style bg=default
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Keep this last.
run-shell -b 'tpane'
Config location
tpane loads top-level Lua files from:
~/.config/tmux/tpane
Set TPANE_CONFIG_DIR to use another directory.
Replace tmux config with Lua
Use tpane.opt for tmux options:
tpane.. = true
tpane.. = 5000
tpane.. = "vi"
tpane.. = true
tpane.. = 0
tmux has options where you usually add one value without replacing the existing values. In tmux.conf that looks like:
set -ga update-environment TERM
set -ga update-environment TERM_PROGRAM
In Lua, use tpane.append for the same thing:
tpane.
tpane.
Bind keys with tmux-aware actions:
tpane.
tpane.
tpane.
tpane.
tpane.
tpane.
tpane.
If some configuration is not supported by tpane, you can always write it the same way you would in tmux:
tpane.
Status bar and tabs
tpane lets you compose the statusline with widgets. It ships with common widgets, and you can add your own when you need something custom.
tpane.
Use rows for a multiline status bar:
tpane.
Built-in widgets:
| Widget | Description |
|---|---|
tpane.widgets.session |
Current tmux session. |
tpane.widgets.host |
Hostname from tmux. |
tpane.widgets.clock |
Current time, like 14:30. |
tpane.widgets.date |
Current date, like Jun 25. |
tpane.widgets.prefix |
Shows when tmux prefix is active. |
tpane.widgets.tabs |
tmux window tabs. |
tpane.widgets.cpu(opts) |
CPU usage. Works on Linux and macOS. |
tpane.widgets.memory(opts) |
Used memory. Works on Linux and macOS. |
tpane.widgets.battery(opts) |
Battery status with icons. Works on Linux and macOS. |
tpane.widgets.player(opts) |
Current playing track. Uses playerctl, Music, or Spotify. |
local cpu = tpane..
local memory = tpane..
local battery = tpane..
local player = tpane..
tpane.
Custom widgets are just Lua functions:
local cwd = tpane.
For widgets that run shell commands, use job. Jobs run in the background and return a handle that widgets can render:
local uptime = tpane.
tpane.
Style tmux window tabs without writing the full tmux format by hand:
tpane.
For lower-level styling, use nested tmux options:
tpane.
Plugins
See docs/plugins.md for plugin details.
Plugins are referenced from Lua. Built-in plugins load by name:
tpane.
tpane.
tpane.
tpane.
The themes plugin bundles the iTerm2 Color Schemes collection:
tpane.
tpane.
Keep the terminal background behind the status bar:
tpane.
Git plugins install when first referenced:
tpane.
You can also reference a path in case the plugin is in a monorepo:
tpane.
And use the CLI to keep track of your plugins:
Reusable panes
Register a pane once, then toggle or expand it from keybinds. Hidden panes keep their process running.
tpane.
-- Show/Hide a pane
tpane.
CLI
Full Lua reference: docs/lua-api.md.