Zellij Tab and Pane Management
Zellij Tab and Pane Management
Zellij is a terminal workspace with built-in tab and pane management. Understanding when to use tabs vs panes improves workflow efficiency.
Tabs vs Panes: When to Use Each
Panes (Split Views)
Use panes when:
- Working on one project with multiple views
- Need to see multiple outputs simultaneously
- Related tasks (e.g., code + tests + logs)
Example workflow:
┌────────────┬────────────┐
│ │ git status │
│ neovim ├────────────┤
│ │ tests │
└────────────┴────────────┘
Create panes:
Ctrl-pthenn→ Split downCtrl-pthend→ Split right
Tabs (Separate Workspaces)
Use tabs when:
- Different projects/contexts
- Task-switching between unrelated work
- Keeping workspace states separate
Example setup:
Tab 1: midimaze/ (vault work)
Tab 2: nnt/ (compiler dev)
Tab 3: PhD/ (dissertation)
Tab 4: system admin (maintenance)
Create tab:
Ctrl-pthent→ New tab
Tab Navigation Shortcuts
Built-in Navigation
Ctrl-p prefix mode:
bashCtrl-p t # Open tab switcher (fuzzy find) Ctrl-p 1-9 # Jump to tab number Ctrl-p [ # Previous tab Ctrl-p ] # Next tab
Tab switcher (fuzzy find):
- Press
Ctrl-pthent - Type partial tab name
- Arrow keys to select
- Enter to switch
Custom Keybindings (Alt-based)
Add to ~/.config/zellij/config.kdl:
kdlkeybinds { normal { bind "Alt h" { GoToPreviousTab; } bind "Alt l" { GoToNextTab; } bind "Alt 1" { GoToTab 1; } bind "Alt 2" { GoToTab 2; } bind "Alt 3" { GoToTab 3; } bind "Alt 4" { GoToTab 4; } bind "Alt 5" { GoToTab 5; } } }
Usage:
Alt-h→ Previous tabAlt-l→ Next tabAlt-1throughAlt-5→ Jump to specific tab
Benefit: No Ctrl-p prefix needed for common navigation.
Pane Navigation
Built-in:
bashCtrl-p h/j/k/l # Navigate panes (Vim-style) Ctrl-p arrows # Navigate panes (arrow keys) Ctrl-p f # Fullscreen current pane (toggle)
Custom (Alt-based):
kdlkeybinds { normal { bind "Alt Left" { MoveFocus "Left"; } bind "Alt Down" { MoveFocus "Down"; } bind "Alt Up" { MoveFocus "Up"; } bind "Alt Right" { MoveFocus "Right"; } } }
Pane Fullscreen (Adobe Premiere "Tilde" Equivalent)
Zellij's pane fullscreen mode:
bashCtrl-p f # Toggle fullscreen for current pane
Behavior:
- Hides all other panes
- Shows only focused pane
- Press again to restore layout
Use cases:
- Reading long output without distraction
- Editing file in full terminal width
- Watching tests run with full visibility
Alternative: Close other panes with Ctrl-p x (destructive).
Session Management
Why sessions matter:
- Sessions persist layouts + tabs + panes
- Resurrect entire workspace after reboot
- Multiple session per project
Create named session:
bashzellij -s midimaze-vault
List sessions:
bashzellij list-sessions
Attach to session:
bashzellij attach midimaze-vault # or zellij attach # Fuzzy find from list
Kill session:
bashzellij kill-session midimaze-vault
Ghostty Tabs vs Zellij Tabs
Question: Why use Ghostty tabs when Zellij has tabs?
Answer: Use Zellij tabs for 99% of workflows.
Ghostty Tabs (Rare Use Cases)
When to use Ghostty tabs:
-
Multiple Zellij sessions simultaneously
Ghostty Tab 1: zellij -s work Ghostty Tab 2: zellij -s personal Ghostty Tab 3: zellij -s experimentsEach Ghostty tab runs separate Zellij instance.
-
SSH sessions
Ghostty Tab 1: ssh user@server1 (Zellij on remote) Ghostty Tab 2: ssh user@server2 (Zellij on remote) Ghostty Tab 3: local Zellij session -
Long-running processes outside Zellij
Ghostty Tab 1: docker logs -f container (no Zellij) Ghostty Tab 2: Zellij normal work
For everything else: Use Zellij tabs.
Why? Zellij sessions are resurrectable - entire workspace (tabs + panes + state) survives reboot.
Workflow Recommendation
Optimal setup:
┌─ Ghostty Window ──────────────────────┐
│ │
│ ┌─ Zellij Session ─────────────┐ │
│ │ │ │
│ │ Tab 1: midimaze/ │ │
│ │ ├─ Pane 1: neovim │ │
│ │ ├─ Pane 2: git status │ │
│ │ └─ Pane 3: test runner │ │
│ │ │ │
│ │ Tab 2: nnt/ │ │
│ │ ├─ Pane 1: neovim │ │
│ │ └─ Pane 2: compiler tests │ │
│ │ │ │
│ │ Tab 3: PhD/ │ │
│ │ └─ Pane 1: LaTeX editor │ │
│ │ │ │
│ └───────────────────────────────┘ │
│ │
└───────────────────────────────────────┘
One Ghostty window, one Zellij session, multiple tabs/panes.
Configuration Tips
Rename tabs for clarity:
bashCtrl-p r # Rename current tab
Example names:
vaultinstead ofmidimaze/nnt-devinstead ofnnt/latexinstead ofPhD/
Easier to navigate with Ctrl-p t (fuzzy finder).
Persistent layouts:
Create ~/.config/zellij/layouts/coding.kdl:
kdllayout { tab name="editor" { pane size=1 borderless=true { plugin location="zellij:tab-bar" } pane split_direction="vertical" { pane pane split_direction="horizontal" { pane pane } } } }
Load layout:
bashzellij --layout ~/.config/zellij/layouts/coding.kdl
Common Pitfalls
❌ Using Ghostty tabs for project switching
- Lose session state on restart
- No resurrect capability
- Extra cognitive overhead
✅ Use Zellij tabs instead
- Sessions persist
zellij attachrestores entire workspace- Faster navigation (
Ctrl-p t)
❌ Creating too many panes
- Hard to see individual panes
- Cluttered workspace
- Better to use tabs
✅ Limit to 2-4 panes per tab
- Primary + support panes
- Use fullscreen (
Ctrl-p f) when needed - Switch tabs for different contexts
Keyboard Shortcut Reference
| Action | Shortcut | Notes |
|---|---|---|
| Tabs | ||
| New tab | Ctrl-p t | Creates empty tab |
| Tab switcher | Ctrl-p t | Fuzzy find |
| Next tab | Ctrl-p ] | Or Alt-l (custom) |
| Previous tab | Ctrl-p [ | Or Alt-h (custom) |
| Jump to tab 1-9 | Ctrl-p 1-9 | Or Alt-1-9 (custom) |
| Rename tab | Ctrl-p r | Makes navigation easier |
| Close tab | Ctrl-p q | |
| Panes | ||
| Split down | Ctrl-p n | Horizontal split |
| Split right | Ctrl-p d | Vertical split |
| Navigate panes | Ctrl-p h/j/k/l | Vim-style |
| Fullscreen pane | Ctrl-p f | Toggle |
| Close pane | Ctrl-p x | |
| Sessions | ||
| Detach | Ctrl-p q | Session keeps running |
| Create session | zellij -s name | CLI |
| Attach session | zellij attach | CLI |
Links
Zellij Documentation
- URL: https://zellij.dev/documentation/
- Summary: Official guide for Zellij terminal workspace
- Related: Ghostty, tmux, Terminal Multiplexers