mine tmux
Manage tmux sessions, attach, and save/restore window layouts. Requires tmux to be installed.
Fuzzy Session Picker
Section titled “Fuzzy Session Picker”mine tmux # interactive picker (TTY) or plain list (piped)mine tx # aliasOpens a fuzzy-searchable list of running tmux sessions. Select a session and press Enter to attach. Falls back to a plain list when stdout is not a TTY.
Project Session (Create or Attach)
Section titled “Project Session (Create or Attach)”mine tmux project # session named after current directorymine tmux project ~/code/myapp # session named "myapp"mine tmux project --layout dev-setup # create with a saved layout appliedmine tmux proj # aliasCreates a tmux session named after the target directory’s basename, or attaches if a session with that name is already running. This single command replaces the mine tmux ls + conditional new/attach workflow for project-based sessions.
- If the session does not exist: it is created and you are attached. With
--layout, the saved layout is applied to the new session before attaching. - If the session already exists: you are attached directly. The
--layoutflag is ignored on attach. - The
--layoutvalue is pre-validated — an error is returned immediately if the layout does not exist.
Shell helper — tp wraps this command for quick use:
tp # project session for cwdtp ~/code/api # project session for ~/code/apiAdd tp to your shell with mine shell init.
Create a Session
Section titled “Create a Session”mine tmux new # auto-names from current directorymine tmux new myproject # explicit namemine tmux new myproject --layout dev # create and immediately apply a saved layoutCreates a new tmux session. If no name is given, the session is named after the current directory.
Use --layout <name> to apply a saved layout immediately after the session is created. If the named layout does not exist, the session is not created and an error is printed — no side effects.
List Sessions
Section titled “List Sessions”mine tmux lsmine tmux listLists all running tmux sessions with window counts. Attached sessions are marked with *.
Attach to a Session
Section titled “Attach to a Session”mine tmux attach myproject # fuzzy match by namemine tmux a proj # short alias, fuzzy matches "myproject"Attaches or switches to a session. The name is fuzzy-matched against running sessions, so partial names work. Without a name, opens the interactive picker.
Kill a Session
Section titled “Kill a Session”mine tmux kill myproject # fuzzy match by namemine tmux kill # interactive pickerKills a tmux session. Supports fuzzy matching and the interactive picker.
Rename a Session
Section titled “Rename a Session”mine tmux rename old new # rename directly, no promptsmine tmux rename oldname # fuzzy-match session, then prompt for new namemine tmux rename # interactive picker, then prompt for new nameRenames a tmux session. In 2-arg mode the rename happens immediately. In 1-arg mode the session is fuzzy-matched by name and you are prompted for the new name. With no args, an interactive picker lets you select the session and then prompts for the new name.
Layouts
Section titled “Layouts”Save and restore window/pane layouts.
Interactive Layout Picker
Section titled “Interactive Layout Picker”mine tmux layout # inside tmux + TTY: fuzzy picker; else: help textWhen run inside a tmux session with a TTY, mine tmux layout (bare, no subcommand) opens an interactive fuzzy-search picker over all saved layouts. Selecting a layout immediately loads it into the current session. Press Esc to cancel without applying any layout.
Outside of tmux or when stdout is not a TTY, the command falls back to showing the subcommand help text. All subcommands (save, load, ls, preview, delete) are always accessible directly.
Save a Layout
Section titled “Save a Layout”mine tmux layout save dev-setupSaves the current tmux session’s window and pane layout. Must be run from inside a tmux session.
Load a Layout
Section titled “Load a Layout”mine tmux layout load dev-setup # load by namemine tmux layout load # interactive picker (TTY) or list (piped)Restores a previously saved layout. Must be run from inside a tmux session. Without a name, opens an interactive fuzzy picker over saved layouts. Falls back to listing available layout names when stdout is not a TTY.
List Saved Layouts
Section titled “List Saved Layouts”mine tmux layout lsmine tmux layout listLists all saved layouts with window counts, window names, and save timestamps.
Preview a Layout
Section titled “Preview a Layout”mine tmux layout preview dev-setupDisplays a layout’s name, save timestamp, and a table of windows with their pane counts and directories — without loading or modifying any tmux session. Works outside of tmux, making it useful for verifying you have the right layout before running layout load.
Delete a Layout
Section titled “Delete a Layout”mine tmux layout delete dev-setup # delete by namemine tmux layout delete # interactive picker (TTY)Permanently removes a saved layout. With no arguments, opens an interactive picker to select which layout to delete. Returns an error if the named layout does not exist.
Windows
Section titled “Windows”Manage windows within a tmux session. All window subcommands default to the current session when inside tmux. Use --session <name> to target a specific session.
List Windows
Section titled “List Windows”mine tmux window ls # windows in current sessionmine tmux window ls --session s # windows in session "s"mine tmux window list # aliasLists all windows in the session with their index, name, and active indicator (*).
Create a Window
Section titled “Create a Window”mine tmux window new <name>mine tmux window new editor --session myprojectCreates a new named window in the current (or specified) session.
Kill a Window
Section titled “Kill a Window”mine tmux window kill <name> # kill by exact namemine tmux window kill # interactive picker (TTY)mine tmux window kill --session s editorKills a window. With no name, opens an interactive fuzzy picker to select the window. Falls back to listing windows when stdout is not a TTY.
Rename a Window
Section titled “Rename a Window”mine tmux window rename old new # rename directly, no promptsmine tmux window rename oldname # select by name, then prompt for new namemine tmux window rename # interactive picker, then prompt for new namemine tmux window rename --session s editor codeRenames a window. In 2-arg mode the rename is immediate. In 1-arg mode the window is matched by exact name and you are prompted for the new name. With no args, an interactive picker lets you select the window and then prompts for the new name.
| Flag | Description |
|---|---|
--session <name> | Target session (defaults to current session inside tmux) |
Examples
Section titled “Examples”# Create or attach to a project session (recommended workflow)mine tmux project ~/code/myapi
# Same thing, from inside the project directorycd ~/code/myapi && mine tmux project
# Create and attach, applying a saved layoutmine tmux project ~/code/myapi --layout dev-3pane
# Use the shell helpertp ~/code/myapi
# Create and attach to a project session (explicit)mine tmux new myapi
# Save your dev layout (3 panes: editor, server, tests)mine tmux layout save dev-3pane
# Create a new session and immediately apply your saved layoutmine tmux new myapi --layout dev-3pane
# Preview a layout before loading itmine tmux layout preview dev-3pane
# Restore a layout — interactive picker inside tmux, or specify by namemine tmux layoutmine tmux layout load dev-3pane
# Remove a layout you no longer needmine tmux layout delete dev-3pane
# Manage windows within a sessionmine tmux window lsmine tmux window new editormine tmux window kill old-windowmine tmux window rename old-name new-name
# Switch between sessionsmine tmux
# Rename a sessionmine tmux rename old-name new-name
# Clean upmine tmux kill old-project