Skip to content

feat(rex): open files and the message in $EDITOR beside the pane - #7

Merged
owlnai merged 1 commit into
feat/rex-zoomfrom
feat/rex-editor-pane
Nov 11, 2026
Merged

owlnai merged 1 commit into
feat/rex-zoomfrom
feat/rex-editor-pane

Conversation

@owlnai

@owlnai owlnai commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Written by an AI agent on behalf of @owlnai. @owlnai has not reviewed it yet.

This is the second layer of four and sits on the zoom layer. To fix something you saw in a diff, you had to find the file in another pane and open it yourself. Ctrl+E opened the commit message in $EDITOR inside rex-git's own narrow pane, which hid rex-git while you wrote.

What changed

  • o opens the selected file, or the one in the diff, in $EDITOR at its first change.
  • In Rex, o opens the editor in a new pane in the same window. The pane goes right of the biggest other pane, so rex-git keeps its width, and you can drag it anywhere. O opens it in a new tab instead.
  • Ctrl+E opens the commit message in a pane the same way. The box shows "editing in $EDITOR…", and the edited message comes back when the editor exits.
  • When the editor exits, its pane or tab closes and focus goes back to rex-git.
  • The first change is passed as +N to vi, vim, nvim, nano, emacs, kak, micro and mg, as path:N to helix and zed, and as -g path:N to code, cursor and windsurf. Other editors just get the path.
  • Outside Rex, both keys open the editor in rex-git's own pane, as Ctrl+E did before.
  • While the message is being edited, switching worktrees waits, like it already did for a draft or a push.

Evidence

This is from a throwaway Rex session with a temp repo where line 4 of f.txt changed. EDITOR=vim, and the window has a shell at 70% and rex-git at 30%. Pane widths come from rex session inspect.

Window before After o After :q
shell 70 · rex-git 30 shell 35 · f.txt 35 · rex-git 30 shell 70 · rex-git 30

O opened a second window holding only the editor. After :q the session's active window was rex-git's again.

The editor opened at the change:

:echo "line " . line(".")
line 4

Ctrl+E after typing fix: x, then :wq in the editor pane:

 ╭ commit message ─────────────────────────────────────── nothing staged · 10 ╮
 │ ⠼ editing in $EDITOR…                                                      │
 │ fix: x▏                                                                    │

With a body line added in vim, it came back with its lines:

 │ fix: hello                                                                 │
 │                                                                            │
 │ body line▏                                                                 │

When rex-git was alone in its window, o split rex-git's own pane and gave the editor 70%.

cargo fmt --check, cargo clippy --all-targets and cargo test (42 tests, including editor_commands and first_changes) pass on this branch.

Not checked: the fallback outside Rex, where the editor opens in rex-git's own pane, wasn't run by hand; it reuses the old Ctrl+E code. GUI editors without a wait flag (code without -w) return at once, so the message comes back unchanged, as before.

ELI5

Press o on a changed file and your editor opens right next to the git panel, at the line that changed. When you close the editor, you're back where you were.

o opens the selected file, or the one in the diff, in $EDITOR at its
first change. In Rex it opens in a new pane beside the biggest pane in
the window, so rex-git keeps its width, and O opens it in a new tab.
Ctrl+E opens the commit message in a pane the same way and takes the
edited message back when the editor exits. Outside Rex both open in
rex-git's own pane, as Ctrl+E did before.
@owlnai
owlnai added this pull request to stack #10 November 11, 2026 14:20
@owlnai
owlnai merged commit ff0ec62 into main Nov 11, 2026
9 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