Repository navigation
/open: choose a terminal editor when VISUAL and EDITOR are unset (#366) - #439
Merged
Merged
Conversation
#366 (decision D3): with VISUAL and EDITOR unset and no Zed or VS Code around, /open (and `o` in /view) could only say that no editor was known. - src/host/terminalEditors.ts: a curated list (Neovim, Helix, Micro, Vim, nano, Emacs with -nw, Kakoune), detected on PATH only. Detection never runs an editor (no version arguments), and NMSh never installs one (no install recipes; the upstream page is named instead). - Settings → Sessions → Terminal editor opens the existing provider chooser (a new 'editor' provider family, so /providers and Ask see it too). An installed editor is saved as terminalEditor; a missing one shows why and is not saved. The highlighted editor previews the exact command /open would compose; nothing runs. - resolveHostActions keeps explicit choices first: Open with Zed or VS Code, the editor NMSh runs inside, then VISUAL/EDITOR, then the chosen editor, only when installed. With none chosen, the message names the editors installed here and where to choose. - editorArguments adds the column forms nano (+N,C) and Emacs (+N:C) document; Vim, Neovim and Kakoune keep +N; paths stay single arguments and are quoted for the session's shell when composed. Tests: precedence (environment, surrounding editor, explicit Open with, chosen, missing), per-editor line and column forms, configuration normalization, the family and Settings row, and the whole path through TerminalApp with stub executables on a controlled PATH. Ask's coverage audit now knows the family. Refs #366
The Setup coverage audit requires every Settings row and panel to be reachable from Setup. A route row next to Open with opens the editor chooser over Setup; the choice joins the draft on the way back.
This was referenced Oct 18, 2026
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.
Why (#366)
With
$VISUALand$EDITORunset and no Zed or VS Code around NMSh,/opencould only say that no editor was known, even when Neovim, Helix or Micro was installed.What changed
editorprovider family, so/providersand Ask know it too). It lists Neovim, Helix, Micro, Vim, nano, Emacs (-nw) and Kakoune, marks which are installed here, and previews the exact command/openwould compose for the highlighted one (nothing runs).resolveHostActions): Open with Zed or VS Code, then the editor NMSh runs inside, thenVISUAL/EDITOR, then the chosen editor (only when installed). If the chosen one is missing,/opensays so plainly. With nothing chosen, the message names the editors installed here and where to choose.editorArguments): Helixfile:N:C, Micro+N:C, nano+N,C, Emacs+N:C; Vim, Neovim and Kakoune+N(no documented column flag). Unknown editors get no guessed flag./editis untouched.Dependency:
oin/view(#434) uses the same bridge; it picks up the chosen editor once both are merged. This PR is independent of #434.Verification
tests/terminalEditor.test.ts(precedence: environment, surrounding editor, explicit Open with, chosen, missing; per-editor forms; adversarial path; configuration normalization; the family; the Settings row; no recipes or version runs in the catalog) andtests/terminalEditorApp.test.ts(the realTerminalAppwith stub executables on a controlled PATH,VISUAL/EDITOR/ZED_TERMcleared: the chooser detects installed and missing editors, previews the command, refuses a missing one, saves an installed one, and/opencomposes Helix's form quoted). The new module and setting do not exist ondev.npm run verifyon4ab9f44a: 3141 pass, 5 fail, 2 skipped.898fbc33: Setup's coverage audit requires every Settings row and panel to be reachable from Setup, and the new row was not. Setup → Sessions & alerts → Terminal editor now opens the same chooser over Setup and comes back to the same step with the choice in the draft (other unapplied edits kept). New test intests/terminalEditorApp.test.ts, which fails without the fix; Setup coverage, Setup order and the editor tests: 21/21.Physical QA (not done)
Ghostty and Terminal.app with
VISUAL/EDITORunset (for exampleenv -u VISUAL -u EDITOR nmsh):/open README.md:3explains and names the installed editors; choose one in Settings → Terminal editor;/open README.md:3:2puts its command in the composer at the right line; Enter opens it; quitting returns to NMSh. Choosing an editor that is not installed is refused. Inside Zed's and VS Code's integrated terminals the surrounding editor still wins.Refs #366