Feature Description
User autocmd events fired on key plugin state changes, so configs and other plugins can react without poking at internals.
Use Case
When a diff opens, the terminal float is still visible and covers the diff buffers. Without an event to hook into, there's no clean way to auto-hide it. I'm currently matching BufWinEnter against the claudecode_diffs cache path — it works but it's fragile and depends on an internal implementation detail.
Same problem applies to connection state and terminal visibility: there's no way to know when Claude connects/disconnects or when the terminal opens/hides without overriding commands or watching buffers.
Proposed Solution
Fire doautocmd User <event> at the appropriate points. Suggested events:
ClaudeCodeDiffOpened — when a diff view is created (_open_native_diff)
ClaudeCodeDiffClosed — when a diff is accepted or rejected (_resolve_diff_as_saved, _resolve_diff_as_rejected)
ClaudeCodeConnected — when the MCP socket connects (start)
ClaudeCodeDisconnected — when the connection drops or stop is called
ClaudeCodeTerminalOpened — when the terminal window is shown
ClaudeCodeTerminalHidden — when the terminal window is hidden
Alternatives Considered
Matching on BufWinEnter with the cache path. Works but breaks if the path changes and isn't a stable API.
Additional Context
This opens up a clean integration surface for things like auto-hiding the terminal on diff open, triggering status line updates, or external tooling reacting to connection state.
Feature Description
User autocmd events fired on key plugin state changes, so configs and other plugins can react without poking at internals.
Use Case
When a diff opens, the terminal float is still visible and covers the diff buffers. Without an event to hook into, there's no clean way to auto-hide it. I'm currently matching
BufWinEnteragainst theclaudecode_diffscache path — it works but it's fragile and depends on an internal implementation detail.Same problem applies to connection state and terminal visibility: there's no way to know when Claude connects/disconnects or when the terminal opens/hides without overriding commands or watching buffers.
Proposed Solution
Fire
doautocmd User <event>at the appropriate points. Suggested events:ClaudeCodeDiffOpened— when a diff view is created (_open_native_diff)ClaudeCodeDiffClosed— when a diff is accepted or rejected (_resolve_diff_as_saved,_resolve_diff_as_rejected)ClaudeCodeConnected— when the MCP socket connects (start)ClaudeCodeDisconnected— when the connection drops orstopis calledClaudeCodeTerminalOpened— when the terminal window is shownClaudeCodeTerminalHidden— when the terminal window is hiddenAlternatives Considered
Matching on
BufWinEnterwith the cache path. Works but breaks if the path changes and isn't a stable API.Additional Context
This opens up a clean integration surface for things like auto-hiding the terminal on diff open, triggering status line updates, or external tooling reacting to connection state.