Skip to content

feat(tui): add /edit-last command to open last assistant message in editor#11595

Closed
jung-ho-1231 wants to merge 1 commit intoanomalyco:devfrom
jung-ho-1231:feat/edit-last-command
Closed

feat(tui): add /edit-last command to open last assistant message in editor#11595
jung-ho-1231 wants to merge 1 commit intoanomalyco:devfrom
jung-ho-1231:feat/edit-last-command

Conversation

@jung-ho-1231
Copy link
Copy Markdown

@jung-ho-1231 jung-ho-1231 commented Feb 1, 2026

Fixes #11598

Summary

Adds a new slash command "/edit-last" that opens the last assistant message in an external editor (vim/nvim/code etc.) for editing.

What does this PR do?

When users type "/edit-last" or select it from the command dialog, the last assistant message will be opened in the external editor configured via VISUAL or EDITOR environment variable.

Changes

  • Added new command "Open last assistant message in editor" in session/index.tsx
  • Command is only visible when VISUAL or EDITOR environment variable is set
  • After editing and saving (:wq in vim), the edited content is loaded into the prompt input
  • If no changes are made (:q!), the original message remains unchanged
  • Users must press Enter to send the edited message

How did you verify your code works?

  • Typechecked with bun run typecheck - all 12 packages passed
  • Manual testing scenarios:
    1. Without EDITOR set: command does not appear in command palette
    2. With EDITOR=vim: /edit-last opens vim with last assistant message
    3. After :wq in vim: edited content appears in input prompt
    4. After :q! in vim: "No changes made" toast shown, input unchanged

Requirements

Users need to set the EDITOR or VISUAL environment variable:

export EDITOR=vim    # or nvim, nano, code, etc.
export VISUAL=nvim   # takes precedence over EDITOR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 1, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions bot closed this Apr 3, 2026
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.

feat(tui): add /edit-last command to open last assistant message in external editor

1 participant