[FEATURE] Multiple Named Terminal Layout Configurations
まだ誰も着手していません。
評価
調査の方向性
まず、既存のターミナル設定と、open()、focus()、:ClaudeCode コマンドの背後にある Lua API を読みます。ターミナルバッファ、レイアウトオプション、Claude CLI プロセス、WebSocket サーバーがどのように管理されているかを追跡します。名前付き設定、デフォルトおよび無効なレイアウトの動作、レイアウトの切り替え、後方互換性が、追加の Claude インスタンスを作成せずに機能すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem / Use Case
Currently, claudecode.nvim only supports a single terminal layout configuration. Users who want to interact with Claude Code in different contexts (e.g., floating window for quick queries, side split for longer sessions) must either:
- Reconfigure and reload the plugin to change layouts
- Create multiple independent Claude instances (which breaks the single conversation flow)
- Manually manipulate windows after opening
This limitation makes it difficult to have flexible workflow patterns while maintaining a single Claude conversation instance.
Proposed Solution
Support multiple named terminal layout configurations accessible via Lua API, allowing layout selection to be completely separate from Claude CLI arguments.
Configuration Example
{
"coder/claudecode.nvim",
opts = {
terminal = {
-- Define multiple named configurations
configurations = {
float = {
snacks_win_opts = {
position = "float",
width = 0.8,
height = 0.8,
border = "rounded",
}
},
split = {
snacks_win_opts = {
position = "right",
width = 0.4,
border = "rounded",
}
},
drawer = {
snacks_win_opts = {
position = "bottom",
height = 0.3,
border = "single",
}
}
},
-- Optional: specify default configuration
default = "float" -- used when no layout is specified
},
},
}
Lua API Usage
-- Open Claude with specific layout and arguments
require("claudecode").open({
layout = "split",
args = "--dangerously-skip-permissions --continue"
})
-- Or just layout (uses default args)
require("claudecode").open({ layout = "float" })
-- Or just args (uses default layout)
require("claudecode").open({ args = "--continue" })
-- Focus with layout preference (switch to different layout)
require("claudecode").focus({ layout = "drawer" })
Keymap Examples
-- Floating window for quick access
vim.keymap.set({ "n", "i", "v", "t" }, "<C-M-S-a>", function()
require("claudecode").open({
layout = "float",
args = "--dangerously-skip-permissions --continue"
})
end, { desc = "Claude (floating)" })
-- Split for focused work
vim.keymap.set({ "n", "i", "v", "t" }, "<C-M-S-s>", function()
require("claudecode").open({
layout = "split",
args = "--dangerously-skip-permissions --continue"
})
end, { desc = "Claude (split)" })
-- Drawer for context checking
vim.keymap.set("n", "<leader>ad", function()
require("claudecode").open({
layout = "drawer",
args = "--continue"
})
end, { desc = "Claude (drawer)" })
Command Compatibility
The existing :ClaudeCode command should continue to work unchanged, using the default layout:
" Uses default layout configuration
:ClaudeCode --continue
:ClaudeCode --dangerously-skip-permissions
Benefits
- Single Instance: All layouts reference the same Claude conversation and WebSocket server
- Declarative: Layout configurations defined once, reused everywhere
- No CLI Conflicts: Layout selection completely separate from Claude CLI arguments
- Flexible Workflows: Different layouts for different contexts without reconfiguration
- Backward Compatible: Existing configurations continue to work
- Clean API: Simple, predictable Lua interface
- Composable: Easy to build complex keymaps and commands on top
Backward Compatibility
For backward compatibility, both configuration styles should be supported:
-- Old style (still works, becomes the default configuration)
terminal = {
snacks_win_opts = { position = "float", ... }
}
-- New style (opt-in for multiple configurations)
terminal = {
configurations = {
float = { snacks_win_opts = { ... } },
split = { snacks_win_opts = { ... } }
},
default = "float"
}
If configurations is not specified, the plugin behaves exactly as it does today.
Implementation Notes
- The same Claude CLI process and WebSocket server instance should be reused across all layouts
- When switching layouts, the terminal buffer could be moved to a new window with the requested layout
- The
layoutparameter should be optional; if omitted, use thedefaultconfiguration - Invalid layout names should fall back to the default configuration with a warning
Alternative Considered
Using command-line arguments like :ClaudeCode split --continue was considered but rejected because it would conflict with Claude CLI's native argument parsing and create an antipattern of mixing layout concerns with CLI flags.
- 主要言語
- Lua
- スター
- 3.1k
- フォーク
- 219
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
coder/claudecode.nvim のほかの issue
-
needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
coder/claudecode.nvim#321 ·
-
bug needs-triage
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
coder/claudecode.nvim#314 ·
-
bug needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
coder/claudecode.nvim#313 ·
-
needs-triage
難易度 5/5 1週間以上 初心者へのやさしさ 20/100
coder/claudecode.nvim#319 · リアクション 2 件 ·
-
[BUG] 框选文本一直抱错误信息オープンbug needs-triage
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
coder/claudecode.nvim#316 · コメント 1 件 ·
coder/claudecode.nvim の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
-
revisit-at-release statusline
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
neovim/neovim#42188 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Aska] Issueオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
pterodactyl/game-eggs#640 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信