Skip to content

feat: add close_on_exit terminal configuration option #63

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alvarosevilla95
Copy link

@alvarosevilla95 alvarosevilla95 commented Jun 23, 2025

Summary

Add a new close_on_exit terminal configuration option that controls whether the terminal window closes automatically when the Claude process exits.

Motivation

Claude Code displays valuable spend metrics and usage statistics when the process exits. With the current behavior, the terminal window closes immediately on exit, making these metrics invisible to users. This feature allows users to configure the terminal to remain open so they can review this important information.

Changes

  • New Configuration Option: Add close_on_exit boolean property to terminal settings (defaults to true for backward compatibility)
  • Provider Support: Implement early return logic in both Snacks and native terminal providers
  • Documentation: Update README with the new configuration option and usage example

Usage

{
  "coder/claudecode.nvim",
  opts = {
    terminal = {
      close_on_exit = false, -- Keep terminal open to see spend metrics
    },
  },
}

Benefits

  • Users can now see Claude's spend metrics and final output
  • Helpful for monitoring API usage and costs
  • Maintains backward compatibility
  • Simple configuration option that's easy to understand

Add configurable close_on_exit option to terminal settings that controls
whether the terminal window closes automatically when the Claude process exits.

This allows users to see Claude's spend metrics and final output that are
displayed on process exit, which would otherwise be lost when the terminal
window closes immediately.

- Add close_on_exit property to terminal configuration (default: true)
- Implement early return logic in both snacks and native terminal providers
- Update README documentation with new configuration option
- Maintain backward compatibility with existing behavior
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