Dir Tree Tui
OpenCode V2 TUI plugin: VS Code-style file tree in the sidebar with git status coloring and click-to-open
26
1,460
近 7 天 83
50.9
生态多维模型
10 天前
2026-10-10
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-dir-tree-tui@1.0.6"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-dir-tree-tui@1.0.6"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D opencode-dir-tree-tuiOpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
Browse project files, track Git changes, copy paths, and open files and folders from the OpenCode terminal sidebar.

📦 Install / update / remove
Requires OpenCode ≥ 2.0. Terminal UI (TUI) only.
opencode plugin add opencode-dir-tree-tui
- Update:
opencode plugin update opencode-dir-tree-tui - Remove:
opencode plugin remove opencode-dir-tree-tui
If an update is not reflected, restart the TUI client, not just the server.
On V1, pin opencode-dir-tree-tui@0.5.1 and see the V1 guide.
⚙️ Settings
Run /dirtree-sidebar to open Dir Tree Sidebar. Use Tab / Shift+Tab or click to switch between Settings and Ignore Rules; Esc closes the panel.
| Setting | Description | Available values |
|---|---|---|
| Show file tree | Show/hide the tree and its title | on / off |
| Open file | Open files with the system default app | left-click / middle-click / right-click / off |
| Copy file path | Copy absolute file paths | left-click / middle-click / right-click / off |
| Open folder | Open folders with the system default app | left-click / middle-click / right-click / off |
| Copy folder path | Copy absolute folder paths | left-click / middle-click / right-click / off |
| Expand/collapse folder | Expand/collapse folders | left-click / middle-click / right-click |
Preferences save automatically and survive restarts. Mouse bindings are global; visibility and ignore rules are per-project, including its subdirectory sessions. Panel collapse is temporary and per-terminal.
💡 Notes
Default mouse actions
| Click target | Left-click | Middle-click | Right-click |
|---|---|---|---|
| Folder | Expand / collapse | Copy its absolute path | Open with the system default app |
| File | — | Copy its absolute path | Open with the system default app |
The terminal must forward middle-click rather than use it for paste. Copying paths over SSH requires terminal OSC 52 support.
Git colors
| Color | Status |
|---|---|
| Theme accent | Folder |
| Green | Added A, untracked ??, renamed R, or copied C |
| Yellow | Modified M or changed file type T |
| Red | Deleted D or merge conflicts such as UU / AA / DD |
| Gray | Git-ignored !!; not automatically hidden |
Changed files also show Git status badges such as M, ?? or MM.
Ignore rules
Patterns follow .gitignore syntax; the git command must be available locally.
| Example pattern | Effect |
|---|---|
node_modules/ |
Hide node_modules folders at any depth |
/dist/ |
Hide only the root dist folder |
*.log |
Hide files or folders ending in .log at any depth |
!keep.log |
Place after *.log to show keep.log again |
Rules only hide tree entries; they do not change Git tracking or import .gitignore. A parent folder must be visible before a child can be re-included.
- The expanded tree refreshes on file changes and every 10 seconds. Rules saved in another TUI apply on refresh.
- Git features and default-app opening require the workspace path to be locally accessible.
同类生态推荐
Quotes Tui
opencode-quotes-tui
OpenCode TUI plugin that replaces the home screen tips with a random quote
Branch Guard
opencode-branch-guard
OpenCode plugin: allows, asks, or blocks git mutations (commit, push, merge, rebase, ...) based on the current branch or repository, so protected branches stay clean.
Git Autocommit
opencode-git-autocommit
Zero-config background git auto-commit plugin for OpenCode CLI