Skip to content

Conversation

@snirt
Copy link

@snirt snirt commented Dec 17, 2025

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

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
Copy link
Author

snirt commented Dec 18, 2025

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.

Add jobresize() calls to notify the terminal job of window dimensions
when switching between sessions. This fixes the cursor appearing in
the wrong position and line shifting after session switch.

The terminal job needs to know its window dimensions to correctly
calculate cursor position and line wrapping. Without this, the
terminal renders based on stale window state from the previous session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant