Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add EDITOR integration for multi-line command editing (like Zsh's edit-command-line) #867

@TheRebootr

Description

@TheRebootr

Describe the feature or problem you'd like to solve

When crafting complex, multi-line prompts in Copilot CLI, the built-in line editing (Ctrl+a/e/w/u/) (Alt+f/b) is limited compared to a full text editor. In zsh edit-command-line (bound to Ctrl+X Ctrl+E) which opens the current command buffer in $EDITOR for more powerful editing.

Proposed solution

Proposed Solution:

Add a keybinding (e.g., Ctrl+x Ctrl+e, Ctrl+x+e) or (Ctrl+g - similar to claude code keybind) that:

 - Opens the current input buffer in the user's $EDITOR (or $VISUAL)
 - Allows full editor capabilities (syntax highlighting, multi-cursor, etc.)
 - On save and exit, replaces the input buffer with the edited content
 - On exit without save, leaves the buffer unchanged

Implementation Notes:

 - Respect $EDITOR then $VISUAL environment variables
 - Fallback to sensible defaults (nano/vi/vim)
 - Use temporary file, clean up after editing
 - Similar to how git commit opens editor for commit messages

Example prompts or workflows

On using copilot cli, there are several instances where I have copied a markdown file/code snippet that is fairly long from a read only file/website that I want to edit inline to fit my context. On this case, I would open up vim, edit it then either save it and make copilot refer to it OR I will yank it then put it on the cli text prompt.

For a specific instance, I am working on two projects (a migration) where the old project has features written in markdown. I normally would, open a new scratch buffer, make some necessary edits (with help of copilot-cli in vim it makes editing much easier!) then copy it and put it on the cli prompt.

Additional context

Benefits:

  • Edit long prompts with familiar editor tools (Vim, Neovim, VSCode, etc.)
  • Better support for complex multi-paragraph requests
  • Leverage editor features: search/replace, macros, snippets
  • Improves UX for users with extensive editor configurations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions