https://github.com/mgalgs/tmux-view.el
Emacs package to grab text from your tmux sessions
https://github.com/mgalgs/tmux-view.el
Last synced: 29 days ago
JSON representation
Emacs package to grab text from your tmux sessions
- Host: GitHub
- URL: https://github.com/mgalgs/tmux-view.el
- Owner: mgalgs
- Created: 2026-01-26T19:04:22.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2026-02-12T20:09:58.000Z (5 months ago)
- Last Synced: 2026-03-29T21:47:52.911Z (4 months ago)
- Language: Emacs Lisp
- Size: 16.6 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## tmux-view.el
*Grab text from your tmux sessions*
---
[](http://www.gnu.org/licenses/gpl-3.0.html)
# Overview
Quickly grab text from your tmux sessions, selecting from a rich set of completing read options constructed from your active `tmux` sessions.
- **Full History**: Captures the entire scrollback buffer (not just the visible screen).
- **ANSI Color Support**: Preserves terminal colors so logs and CLI outputs look exactly like they do in your terminal.
- **Auto-Updating**: Press `g` to refresh the buffer with the latest output from the live pane.
- **Read-Only Safety**: Buffers are read-only by default to prevent accidental modification of process output.
- **Single-Query Discovery**: Flat completion list lets you filter by session, window, or process in one step—no multi-step wizards.
# Installation
## use-package (from GitHub)
```elisp
(use-package tmux-view
:vc (:url "https://github.com/mgalgs/tmux-view.el" :rev :newest))
```
## Manual
1. Clone this repository or copy tmux-view.el to your load path.
2. Add the following to your init.el:
```elisp
(require 'tmux-view)
```
# Usage
1. **Invoke**: Run `M-x tmux-view`.
2. **Filter**: You will see a list of all active panes across all tmux sessions formatted as:
```
session/window/pane-index: process [args]
```
3. **Search**: Use your favorite completion engine (Vertico, Ivy, Helm, or default) to narrow it down.
- Example: Type `production/logs` to see all log panes in your "production" session.
- Example: Type `tail` to find any pane currently running a tail command.
4. **View**: Hit `RET`. A new buffer `*tmux: session/window/pane*` will open.
**Note**: Process arguments longer than 40 characters are truncated with `...` to keep the minibuffer readable.
## Keybindings
| Command | Key | Action |
|------------------|-----|--------------------------------------------------------------|
| `M-x tmux-view` | — | Open the pane picker and select a tmux pane to view. |
| `tmux-view-mode` | g | Refresh: Pull the latest text/scrollback from the tmux pane. |
| `tmux-view-mode` | q | Quit: Bury the buffer. |
| `tmux-view-mode` | s | Save: Write the captured output to a file. |
## Technical Details
This package uses the following tmux commands internally:
- **Pane Discovery**: `tmux list-panes -a` - Lists all panes across all sessions
- **Content Capture**: `tmux capture-pane -e -p -S - -t ` - Captures pane contents with:
- `-e`: Includes ANSI escape sequences for color preservation
- `-p`: Outputs to stdout instead of paste buffer
- `-S -`: Captures the entire scrollback history
## Requirements
- Emacs 26.1 or later
- tmux 1.8 or later (for `list-panes -a` and `capture-pane -e -p -S -`)
