anthropics / anthropics/claude-code

[Feature Request] Add option to pre-populate editor buffer with previous assistant message as context

Open
#81,429 0 comments 0 reactions 0 assignees View on GitHub
area:tui stale
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

**Bug Description**
**Title:** Pre-populate `$EDITOR` buffer with prior assistant message as context when editing

**Body:**

When I hit Ctrl-G to compose/edit a message in `$EDITOR`, the buffer opens empty (or with just my in-progress input). For anything more than a one-liner, I want to reference Claude's last response while I'm writing — quoting specific lines, responding point-by-point, disagreeing with a specific claim, etc.

Right now the workflow is: `/copy` to grab the last response, switch to the editor, paste it as a comment block, then write my reply around it. That friction usually pushes me to just type inline in the TUI and lose the better editing experience.

**Request:** an option to pre-fill the editor buffer with the previous assistant message, commented out (using the comment syntax appropriate to the buffer's filetype, or a configurable prefix like `> `). The commented lines would be stripped on save so they don't get sent as part of my prompt.

**Possible shapes this could take:**
- A setting in `settings.json` (e.g. `"editor.includeLastResponse": true`)
- A separate keybind (e.g. Ctrl-G opens empty, Ctrl-Shift-G opens with context)
- A `PreEditorOpen` hook that lets me control buffer contents myself

Any of these would work — the hook version is the most flexible but the setting is the lowest-friction default.

**Environment Info**
- Platform: linux
- Terminal: kitty
- Version: 2.1.126
- Feedback ID: 3ad66f30-503f-48e4-85d3-e76099ae0f18

**Errors**
```json
[{"error":"Error: Request was aborted.\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:3448)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-07-26T18:00:00.252Z"}]
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the Ctrl-G flow that opens $EDITOR and review the proposed settings.json location. The issue leaves a setting, keybind, or PreEditorOpen hook undecided, so first clarify the intended interface; done should include the previous assistant message in the buffer, remove the commented context on save, and preserve the user's prompt.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.