feat: add multi-session terminal support
Add ability to run multiple concurrent Claude Code terminal sessions with session management, smart ESC handling, and session-aware selection tracking.
New commands:
- ClaudeCodeNew: Create a new terminal session
- ClaudeCodeSessions: Show session picker (supports fzf-lua)
- ClaudeCodeSwitch: Switch to session by number
- ClaudeCodeCloseSession: Close session by number or active session
New features:
- Smart ESC handling: double-tap ESC to exit terminal mode, single ESC sends to terminal (configurable via esc_timeout)
- Session-aware selection tracking and message routing
- OSC title handler for capturing terminal title changes
- Configurable terminal keymaps (terminal.keymaps.exit_terminal)
New modules:
- lua/claudecode/session.lua: Session lifecycle management
- lua/claudecode/terminal/osc_handler.lua: Terminal title detection
Found a bug in this PR - killing the claude-code using ctrl-c closes the instance, but does not remove the session record from the session list. I'll fix it soon.
Hi @snirt . Will you keep pushing this forward? This will close two open issues:
- https://github.com/coder/claudecode.nvim/issues/187
- https://github.com/coder/claudecode.nvim/issues/198
LGTM
He, What's the process of this pr. Is this usable? Or maybe we could merge this first and resolve potential problem later if the pr doesn't make a break change.
Hey any updates on this? Would be quite nice to get this merged in.