claudecode.nvim icon indicating copy to clipboard operation
claudecode.nvim copied to clipboard

feat: add multi-session terminal support

Open snirt opened this issue 11 months ago • 5 comments

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

snirt avatar Dec 17 '25 16:12 snirt

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.

snirt avatar Dec 18 '25 07:12 snirt

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

Beloin avatar Mar 21 '26 15:03 Beloin

LGTM

gogongxt avatar Apr 14 '26 02:04 gogongxt

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.

gogongxt avatar Apr 19 '26 16:04 gogongxt

Hey any updates on this? Would be quite nice to get this merged in.

dodofarm avatar May 19 '26 16:05 dodofarm