An interactive tmux session manager that allows you to quickly navigate to project directories and create or switch to tmux sessions.
- Interactive Directory Selection: Uses fzf for fast directory navigation from configured search paths
- Automatic Session Management: Creates new tmux sessions or switches to existing ones
- Project-Specific Configuration: Define custom window layouts and commands per project
- Default Window Templates: Set up default window configurations for all projects
sudo curl -sL https://raw.githubusercontent.com/niedch/mux-session/master/install.sh | bash
mux-session initIf you use TPM, add this to your .tmux.conf:
set -g @plugin 'niedch/mux-session'Then press prefix + I to install the plugin.
# Set the key binding (default: M)
set -g @mux_session_key "f"Press prefix + f (or your custom key) to launch mux-session.
- tmux
Add following lines to .tmux.config
set-option -g default-shell /bin/zsh
bind-key f run-shell "tmux neww mux-session"Create a configuration file at $XDG_CONFIG/mux-session/config.toml (typically ~/.config/mux-session/config.toml).
# Directories to search for projects
search_paths = [ "/home/nic/projects", "/home/nic/work" ]
# Provider for the preview window. Options: "readme", "git". Default: "readme"
preview_provider = "readme"
# Default window configuration for all projects
[default]
[[default.window]]
window_name = "Editor"
cmd = "vim ."
[[default.window]]
window_name = "Runner"
cmd = """
lazydocker
"""
[[default.window]]
window_name = "Terminal"
cmd = ""You can override default settings for specific projects:
# Project-specific configuration
[[project]]
name = "mux-session"
[project.env]
FOO = "bar"
BAZ = "qux"
[[project.window]]
window_name = "nvim"
cmd = "vim ."
[[project]]
name = "dotfiles"
[[project.window]]
window_name = "nvim"
primary = true # This will be the active window when session starts
cmd = "vim ."
[[project.window]]
window_name = "lazydocker"
[[project.window.panel_config]]
panel_direction = "h"
[[project.window.panel_config]]
panel_direction = "h"
cmd = "lazydocker"search_paths: Array of directories to search for projectspreview_provider: Provider for the preview window. Options: "readme", "git". Default: "readme"
Defines window templates that apply to all projects unless overridden.
name: Project name (must match directory name)env: A map of environment variables to set for the session.
window_name: Name of the tmux windowcmd: Command to run in the window (can be multi-line)primary: If true, this window will be selected when session starts
panel_direction: Panel direction (hfor horizontal,vfor vertical)cmd: Command to run in this panel
# Run with default config
mux-session
# Use custom config file
mux-session -f /path/to/config.tomlmux-session- Interactive session selection and creationmux-session config-validate- Validate and display current configuration
- Launches fzf with directories from your configured search paths
- Select a directory to work with
- Checks if a tmux session with that directory name already exists
- If session exists: switches to it
- If session doesn't exist: creates new session with configured windows
- Create your config file:
mkdir -p ~/.config/mux-session
cp config.toml ~/.config/mux-session/- Edit the config to add your project directories
- Run
mux-sessionand start managing your sessions!
# Start mux-session
mux-session
# Select your project from fzf interface
# Automatically creates/switches to tmux session with your configured windows# Clone the repository
git clone https://github.com/niedch/mux-session.git
cd mux-session
make install# Run in development mode
make dev
# Run tests
make test
# Run e2e tests
make e2e
### Available Make Commands
- `make build` - Build the binary to `bin/mux-session`
- `make run` - Build and run the binary
- `make test` - Run tests
- `make e2e` - Run end-to-end tests
- `make clean` - Clean build artifacts
- `make deps` - Download and tidy dependencies
- `make install` - Install binary globally with `go install`
- `make all` - Run tests then build