Skip to content

tui: e edits the file in $EDITOR, x opens it with the system - #42

Merged
ralyodio merged 1 commit into
mainfrom
feat/tui-open-in-editor
Sep 13, 2026
Merged

ralyodio merged 1 commit into
mainfrom
feat/tui-open-in-editor

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

What

e opens the file under the cursor in the system editor; x opens it with whatever the system opens it with. Both work from the panes and from the viewer, and both sit in the footer and the help.

  • Editor: $VISUAL, then $EDITOR, then the first of vim, nvim, nano, vi on PATH. A remote file is edited on the server over ssh -t (port, key and jump host carried over) with the editor the server has, so nothing is downloaded or uploaded back.
  • Open with: a desktop opener (xdg-open, open) when there is a desktop; otherwise a player (mpv, ffplay, vlc) for video and audio, a terminal viewer (chafa, timg, viu) for images, and a message naming what to install when nothing fits. The bytes outrank the name: a text file named code.ts is never sent to a player.
  • Where it runs: under tmux, a new window named after the file, with the browser still up. Without tmux, the browser hands the terminal over the way vim's :sh does, and comes back with every pane where it was and the open document re-read. Modelled on moshcode's /shell and /new.
  • The hex view now says: Not a text file. e edits it; x opens it with a player, a viewer or the desktop.

Tests

18 new tests: the editor chain, local and remote edit commands (quoting included), media routing by desktop and by installed program, the text-over-name rule, the tmux and hand-off paths through a fake launcher, coming back from a hand-off, and the footer caps. 687 tests pass repo-wide; typecheck is clean. The built binary was driven both inside a private tmux server (a code.ts window opened with vim in it) and outside tmux (vim took the terminal, :q brought the browser back).

🤖 Generated with Claude Code

https://claude.ai/code/session_01AhtFxxWvkm4izFq8Y1RQBo

The viewer shows what it can; for the rest the answer is the program the
system already has. `e` opens the file under the cursor in $VISUAL, then
$EDITOR, then vim/nvim/nano/vi — a remote file is edited on the server
over `ssh -t` with the editor the server has. `x` hands a file to the
desktop opener when there is a desktop, or to a player (mpv, ffplay…) or
a terminal image viewer (chafa, timg…) when there is not, and says what
to install when nothing fits.

Under tmux the program gets a window of its own and the browser stays
up beside it; without tmux the browser hands the terminal over, the way
vim's :sh does, and starts again with every pane where it was and the
open document re-read. Modelled on moshcode's /shell and /new.

The bytes outrank the name for `x`: code.ts is TypeScript, not an MPEG
transport stream, and driving the built binary in tmux is where ffplay
was handed a source file.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AhtFxxWvkm4izFq8Y1RQBo
@ralyodio
ralyodio merged commit 717efa8 into main Sep 13, 2026
4 checks passed
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.

1 participant