feat(commands): add /editor command to compose messages in $EDITOR - #7620
Closed
Linux2010 wants to merge 1 commit into
Closed
feat(commands): add /editor command to compose messages in $EDITOR#7620Linux2010 wants to merge 1 commit into
Linux2010 wants to merge 1 commit into
Conversation
Contributor
|
FYI, done with Shortcut instead of command, to be able to go into edit latter not only from empty message #7941 |
This was referenced Apr 27, 2026
Collaborator
…ports The _handle_editor_command() method used subprocess.call() but did not import subprocess, causing AttributeError at runtime. subprocess is not globally imported in gateway/run.py. Other uses of subprocess in this file use local imports (line 1289), so the editor command should follow the same pattern. - Added: import subprocess (local import, matching file pattern) - Removed: redundant local imports for asyncio, shlex, tempfile (already imported globally at lines 16, 21, 24) Python syntax validation (py_compile)
Linux2010
force-pushed
the
feat/issue-7263-editor-command
branch
from
April 30, 2026 09:37
7e084da to
9e5e75c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What added
New
/editor(alias/edit) slash command that opens the user's preferred text editor (EDITOR,VISUAL, or auto-detectednano/vim/vi) to compose long messages. Save and close to queue the message; leave empty to cancel.Target Users
Gateway platform users (Telegram, Discord, Slack, WhatsApp, Signal):
/editoris the only way to use external editor on these platformsCLI users: See #7941 for a better solution (Ctrl+G shortcut + paste collapse)
Related Work
Ctrl+Gshortcut for CLI + large paste collapseBoth PRs are complementary, not competing:
open_in_editor())Implementation
hermes_cli/commands.pyCommandDeffor "editor" with "edit" aliasgateway/run.py_handle_editor_command()method (88 lines)Editor detection:
$EDITOR→$VISUAL→ auto-detect (nano→vim→vi)Message handling: Uses same pattern as
/queue— queues inadapter._pending_messagesComment stripping: Lines starting with
#are ignored (hint comments)Why this is minimal
/queue)What I tested
Added test suite
tests/gateway/test_editor_command.pywith 8 test cases.Python syntax validated for all files.
What I intentionally did not change
Fixes #7263
Note: For CLI users, recommend using #7941 (Ctrl+G) instead — it's more ergonomic and includes paste collapse.