home / skills / zenobi-us / dotfiles / zellij

This skill helps you automate Zellij session, tab, and pane management via CLI commands for efficient terminal multiplexing.

npx playbooks add skill zenobi-us/dotfiles --skill zellij

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
3.5 KB
---
name: zellij
description: Use when manipulating Zellij sessions, creating tabs or panes, or looking up Zellij CLI commands for terminal multiplexer operations
---

# Zellij Reference

## Overview

Quick reference for Zellij CLI commands to manipulate running sessions. Covers session management, tabs, and panes.

## When to Use

- Creating or attaching to Zellij sessions
- Managing tabs and panes programmatically
- Need CLI commands (not keybindings)
- Automating Zellij operations

**When NOT to use:**
- Looking for keybindings (this is CLI only)
- Layout file syntax
- Configuration options

## Quick Reference

### Sessions

| Task | Command |
|------|---------|
| Create/attach session | `zellij attach --create <name>` or `zellij -s <name>` |
| List sessions | `zellij list-sessions` |
| Kill session | `zellij kill-session <name>` |
| Delete session | `zellij delete-session <name>` |

### Tabs

| Task | Command |
|------|---------|
| New tab | `zellij action new-tab` |
| New tab with name | `zellij action new-tab --name <name>` |
| New tab with cwd | `zellij action new-tab --cwd <path>` |
| New tab with layout | `zellij action new-tab --layout <layout>` |
| Close tab | `zellij action close-tab` |
| Rename tab | `zellij action rename-tab <name>` |
| Go to tab by name | `zellij action go-to-tab-name <name>` |
| Go to tab by index | `zellij action go-to-tab <index>` |

### Panes

| Task | Command |
|------|---------|
| New pane (auto) | `zellij action new-pane` |
| Split right | `zellij action new-pane --direction right` |
| Split down | `zellij action new-pane --direction down` |
| Floating pane | `zellij action new-pane --floating` |
| Floating with size | `zellij action new-pane --floating --width 80% --height 60%` |
| Pane with command | `zellij action new-pane -- <command>` |
| Close pane | `zellij action close-pane` |
| Rename pane | `zellij action rename-pane <name>` |

### Common Patterns

**New tab for specific task:**
```bash
zellij action new-tab --name "backend" --cwd ~/api
```

**Split pane and run command:**
```bash
zellij action new-pane --direction down -- npm run dev
```

**New pane with guaranteed working directory:**
```bash
# For interactive shell with specific directory
zellij action new-pane --cwd /path/to/dir

# For command that must run in specific directory
zellij action new-pane --cwd /path/to/dir -- sh -c 'cd /path/to/dir && your-command'

# For nvim that must start in specific directory
zellij action new-pane --cwd /path/to/worktree -- sh -c 'cd /path/to/worktree && nvim'
```

**Floating scratch terminal:**
```bash
zellij action new-pane --floating --width 90% --height 90%
```

## Common Mistakes

**❌ Using `new-pane --horizontal`**
Correct: `--direction down` (not `--horizontal`)

**❌ Confusing toggle with create**
- `toggle-floating-panes` = show/hide existing floating panes
- `new-pane --floating` = create NEW floating pane

**❌ Forgetting `action` subcommand**
Wrong: `zellij new-tab`
Right: `zellij action new-tab`

**❌ Pane not starting in correct directory**
Problem: Using `--cwd` alone doesn't always ensure the command runs in that directory
```bash
# ❌ Wrong - nvim might not start in the right directory
zellij action new-pane --cwd /path/to/worktree -- nvim

# ✅ Correct - explicitly cd first
zellij action new-pane --cwd /path/to/worktree -- sh -c 'cd /path/to/worktree && nvim'
```

## Notes

- All `zellij action` commands work inside or outside a session
- Use `--` to separate pane command from zellij options
- Direction options: `right`, `left`, `up`, `down`
- Size units: bare integers or percentages (e.g., `80%`)

Overview

This skill provides a concise CLI reference and actionable patterns for manipulating Zellij sessions, tabs, and panes. It focuses on zellij subcommands and examples you can use in scripts or terminal automation. Use it to reliably create, navigate, and configure terminal layouts without digging through keybinding docs.

How this skill works

The skill inspects common Zellij command patterns and returns exact CLI invocations for session management, tab operations, and pane control. It highlights correct flag usage, how to run commands inside panes, and common pitfalls to avoid when automating. Examples include one-liners for creating named tabs, splitting panes, and launching commands in specific working directories.

When to use it

  • Creating or attaching to Zellij sessions in scripts or provisioning steps
  • Programmatically creating named tabs or splitting panes from tooling
  • Starting commands in panes with guaranteed working directories
  • Automating workspace setup for projects or CI environments
  • Looking up exact zellij CLI invocations (not keybindings)

Best practices

  • Always use the action subcommand (zellij action ...) — zellij new-tab is incorrect
  • When running a command in a pane, use -- to separate zellij options from the command
  • To ensure a command starts in a directory, cd explicitly in the shell: sh -c 'cd /path && cmd'
  • Prefer direction values right/left/up/down rather than deprecated flags
  • Use percentages or integers for pane sizes and include units for clarity (e.g., 80%)

Example use cases

  • Create or attach a persistent session: zellij attach --create mysession
  • Open a named tab in a project directory: zellij action new-tab --name backend --cwd ~/api
  • Split the current pane down and run the dev server: zellij action new-pane --direction down -- npm run dev
  • Launch a floating scratch terminal at 90% size: zellij action new-pane --floating --width 90% --height 90%
  • Start nvim in a worktree ensuring correct cwd: zellij action new-pane --cwd /path -- sh -c 'cd /path && nvim'

FAQ

Can I run action commands outside of a session?

Yes. All zellij action commands work both inside and outside running sessions.

How do I ensure a pane runs in a specific directory?

Use --cwd plus an explicit shell cd: zellij action new-pane --cwd /dir -- sh -c 'cd /dir && your-command'.