zellij
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseZellij Reference
Zellij 参考文档
Overview
概述
Quick reference for Zellij CLI commands to manipulate running sessions. Covers session management, tabs, and panes.
用于操作运行中会话的Zellij CLI命令快速参考,涵盖会话管理、标签页和窗格相关操作。
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
- 创建或连接到Zellij会话
- 以编程方式管理标签页和窗格
- 需要使用CLI命令(而非快捷键)
- 自动化Zellij操作
不适用场景:
- 查找快捷键(本文档仅涉及CLI)
- 布局文件语法
- 配置选项
Quick Reference
快速参考
Sessions
会话
| Task | Command |
|---|---|
| Create/attach session | |
| List sessions | |
| Kill session | |
| Delete session | |
| 操作任务 | 命令 |
|---|---|
| 创建/连接会话 | |
| 列出会话 | |
| 终止会话 | |
| 删除会话 | |
Tabs
标签页
| Task | Command |
|---|---|
| New tab | |
| New tab with name | |
| New tab with cwd | |
| New tab with layout | |
| Close tab | |
| Rename tab | |
| Go to tab by name | |
| Go to tab by index | |
| 操作任务 | 命令 |
|---|---|
| 新建标签页 | |
| 新建带名称的标签页 | |
| 新建指定工作目录的标签页 | |
| 新建指定布局的标签页 | |
| 关闭标签页 | |
| 重命名标签页 | |
| 通过名称切换到标签页 | |
| 通过索引切换到标签页 | |
Panes
窗格
| Task | Command |
|---|---|
| New pane (auto) | |
| Split right | |
| Split down | |
| Floating pane | |
| Floating with size | |
| Pane with command | |
| Close pane | |
| Rename pane | |
| 操作任务 | 命令 |
|---|---|
| 自动新建窗格 | |
| 向右拆分窗格 | |
| 向下拆分窗格 | |
| 新建浮动窗格 | |
| 新建指定大小的浮动窗格 | |
| 新建执行指定命令的窗格 | |
| 关闭窗格 | |
| 重命名窗格 | |
Common Patterns
常见使用模式
New tab for specific task:
bash
zellij action new-tab --name "backend" --cwd ~/apiSplit pane and run command:
bash
zellij action new-pane --direction down -- npm run devNew pane with guaranteed working directory:
bash
undefined为特定任务新建标签页:
bash
zellij action new-tab --name "backend" --cwd ~/api拆分窗格并运行命令:
bash
zellij action new-pane --direction down -- npm run dev新建指定工作目录的窗格:
bash
undefinedFor interactive shell with specific directory
带指定目录的交互式shell
zellij action new-pane --cwd /path/to/dir
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'
zellij action new-pane --cwd /path/to/dir -- sh -c 'cd /path/to/dir && your-command'
For nvim that must start in specific directory
必须在指定目录启动的nvim
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%zellij action new-pane --cwd /path/to/worktree -- sh -c 'cd /path/to/worktree && nvim'
**新建浮动临时终端:**
```bash
zellij action new-pane --floating --width 90% --height 90%Common Mistakes
常见错误
❌ Using
Correct: (not )
new-pane --horizontal--direction down--horizontal❌ Confusing toggle with create
- = show/hide existing floating panes
toggle-floating-panes - = create NEW floating pane
new-pane --floating
❌ Forgetting subcommand
Wrong:
Right:
actionzellij new-tabzellij action new-tab❌ Pane not starting in correct directory
Problem: Using alone doesn't always ensure the command runs in that directory
--cwdbash
undefined❌ 使用
正确用法:(而非)
new-pane --horizontal--direction down--horizontal❌ 混淆切换与创建操作
- = 显示/隐藏已有的浮动窗格
toggle-floating-panes - = 创建新的浮动窗格
new-pane --floating
❌ 忘记子命令
错误写法:
正确写法:
actionzellij new-tabzellij action new-tab❌ 窗格未在指定目录启动
问题:仅使用并不总能确保命令在该目录运行
--cwdbash
undefined❌ Wrong - nvim might not start in the right directory
❌ 错误写法 - nvim可能不会在正确目录启动
zellij action new-pane --cwd /path/to/worktree -- nvim
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'
undefinedzellij action new-pane --cwd /path/to/worktree -- sh -c 'cd /path/to/worktree && nvim'
undefinedNotes
注意事项
- All commands work inside or outside a session
zellij action - Use to separate pane command from zellij options
-- - Direction options: ,
right,left,updown - Size units: bare integers or percentages (e.g., )
80%
- 所有命令在会话内部或外部均可使用
zellij action - 使用分隔窗格命令与Zellij选项
-- - 方向选项包括:、
right、left、updown - 尺寸单位:纯数字或百分比(例如:)
80%