Easily Set Up Your Usual tmux Pane Layout

teihennteihenn
3 min read

Overview

Every time I start new development work, I have to manually split tmux panes, navigate to the necessary directories in each pane, and execute commands. This got tedious, so I created a tool called tsps to eliminate this repetitive work.

https://github.com/yyossy5/tsps

https://crates.io/crates/tsps

tsps Demo

I've prepared a demo video since seeing it in action is the quickest way to understand:

Key Features

  • Simple Operation: Create multiple panes with a single command

  • Automatic Directory Navigation: Move all panes to a specified directory

  • Automatic Command Execution: Run arbitrary commands in each pane automatically

  • YAML Configuration: Reusable custom layout configurations

  • Focus Control: Specify which pane gets initial focus

Installation

I recommend installing via Cargo:

cargo install tsps

For macOS users without Cargo, I've also prepared pre-built binaries in the Releases. Details are available in the README.

Basic Usage

Simple Pane Splitting

Create a specified number of panes, all navigated to the specified directory:

# Create 4 panes, all cd'd to the current directory
tsps 4 .

# Create 3 panes, all cd'd to a specific project directory
tsps 3 /path/to/project

Using YAML Configuration Files

For even more convenience, use YAML files:

tsps -l config.yaml -d /path/to/project

YAML Configuration Files

I expect that using configuration files will be the most common use case.

Simple Example

# Simple 2-pane layout
workspace:
  name: "simple"
  description: "2-pane layout with editor and terminal"
  directory: "."

panes:
  - id: "editor"
    commands:
      - "nvim ."
    focus: true

  - id: "terminal"
    split: "horizontal"

This configuration creates:

  • Editor pane (launches Neovim, has focus)

  • Terminal pane (positioned with horizontal split)

More Practical Example

# Development layout example
workspace:
  name: "dev"
  description: "4-pane layout for development"
  directory: "/Users/me/Projects/tsps"

panes:
  # Main editor (top-left)
  - id: "editor"
    commands:
      - "nvim ."
    focus: true

  # Claude Code (top-right, smaller)
  - id: "claude"
    split: "vertical"
    size: "38%"
    commands:
      - "claude"

  # General terminal (bottom-left)
  - id: "terminal"
    split: "horizontal"
    size: "30%"
    commands:
      - "ls -la"

  # Git operations (bottom-right, larger)
  - id: "git"
    split: "vertical"
    size: "60%"
    commands:
      - "lazygit"

This configuration creates:

  1. editor pane: Opens the project in Neovim

  2. claude pane: Vertical split, 38% size, launches Claude CLI

  3. terminal pane: Horizontal split, 30% size, displays directory contents

  4. git pane: Vertical split, 60% size, launches Lazygit

The result looks like this:

Configuration Options Details

OptionDescriptionExample
nameWorkspace name"development"
descriptionDescription text"Development setup"
directoryWorking directory (can be overridden with -d option)"~/projects/myapp"
splitSplit direction"horizontal" / "vertical"
sizePane size (%)50
commandsArray of commands to execute["git status", "npm start"]
focusInitial focustrue / false

Conclusion

If you use tmux and want to make your daily development workflow a bit easier, please give this tool a try.

0
Subscribe to my newsletter

Read articles from teihenn directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

teihenn
teihenn