jj-compose 0.2.0

Easily split big jujutsu working copy changes into atomic commits
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
# jj-compose

<p align="center">
  <a href="https://crates.io/crates/jj-compose"><img src="https://img.shields.io/crates/v/jj-compose.svg" alt="crates.io"></a>
  <a href="https://docs.rs/jj_release_core"><img src="https://img.shields.io/docsrs/jj_compose_core" alt="docs.rs"></a>
  <a href="LICENSE"><img src="https://img.shields.io/crates/l/jj-compose.svg" alt="License"></a>
</p>

An interactive terminal UI for Jujutsu ([jj](https://jj-vcs.github.io/jj/)) that
helps you split working-copy changes into atomic, structured
[Conventional Commits](https://www.conventionalcommits.org/) while viewing the
diff.

<p align="center">
  <img src="https://raw.githubusercontent.com/saylesss88/jj-compose/main/assets/jj-compose.png"
       alt="jj-compose: compose atomic commits" width="400">
</p>

## Features

- **Strict Conventional Commits:** Draft structured messages with automatic
  validation for types, scopes, header lengths (50/72 chars), and Git trailers.
- **Line-Level Splitting:** When one hunk holds two unrelated edits, `e` divides
  it so each line can go to a different commit. A rename in one, the logic
  change beside it in another.
- **Interactive Hunk Splitting:** Press `Alt-s` to review your change hunk by
  hunk. Mark the pieces that belong together and commit them instantly—zero
  external `ui.diff-editor` configuration required.
- **Live, Responsive Diffing:** View the full `jj` diff alongside your commit
  form. The layout automatically stacks on narrow terminals and flags stale
  diffs if you edit files in another window.
- **Rewriting released history:** `--ignore-immutable` splits even a tagged
  release, naming the tags it strands and printing the commands to re-anchor
  them.
- **First-Class Vim Keymap:** Use intuitive UI defaults, or launch with
  `--keymap vim` for full Normal/Insert mode modal editing (supports standard
  motions, operators, and visual selections).
- **Lossless Parsing:** Safely revises existing descriptions. If an old commit
  message doesn't perfectly match the Conventional format, it opens in a raw
  text editor to prevent accidental mangling.
- **External Tool Integration:** Press `o` to instantly open the current file or
  change in your configured external diff viewer (like Meld or Difftastic).

## Install

```sh
cargo install jj-compose
```

Install the pre-compiled binary with `cargo-binstall`:

```sh
cargo binstall jj-compose
```

Add an alias so it runs as `jj compose`:

```toml
# ~/.config/jj/config.toml
[aliases]
compose = ["util", "exec", "--", "jj-compose"]
```

To always use the Vim keymap, add it to the alias:

```toml
compose = ["util", "exec", "--", "jj-compose", "--keymap", "vim"]
```

---

## Quick start

You've been working for an hour and `@` now holds a bug fix, a refactor, and a
docs tweak. That's one change with three commits' worth of work in it. Run:

```sh
jj compose
```

1. **Press `Alt-s`.** The diff pane switches to split mode and shows one hunk at
   a time.
2. **Press `f`** to see every hunk in the change at once, with the function each
   one sits in.
3. **Assign hunks with digits.** Move with `j`/`k` and press `1` on each hunk
   that belongs to the fix and `2` on each one that belongs to the refactor.
   Leave the docs hunks unassigned so they stay in the remainder. Lower numbers
   are committed first, so `1` becomes the earliest commit. Nothing is final
   yet: press a digit again or `0` to take a hunk back out.
4. **Press `Enter`** to go to the form. The status bar shows
   `Describing commit 1 of 3`.
5. **Write the message and press `Ctrl-s`.** jj-compose commits those hunks,
   reopens on what's left, and moves on to commit 2. Do the same for that one.
6. **Describe the remainder last.** The docs tweak is all that's left, and its
   message goes on `@`.

The result:

```text
@  docs: clarify empty-input behavior
○  refactor(lexer): extract token helpers
○  fix(parser): return no tokens for empty input
```

You get three atomic commits, ordered so each one builds, and you never left the
terminal or touched `ui.diff-editor`.

If you change your mind partway through, press `Alt-←` to go back to the hunks
and change the marks. To make a single commit with no split, skip `Alt-s`, fill
in the form, and press `Ctrl-s`.

## Usage

```sh
jj-compose              # describe @
jj-compose -r @-        # revise the parent's description
jj-compose <revset>     # any single mutable revision
```

| Option                    | Effect                                                       |
| ------------------------- | ------------------------------------------------------------ |
| `-r, --revision <REVSET>` | Revision to describe (or pass it positionally). Default `@`. |
| `-R, --repository <PATH>` | Repository to operate on, as with `jj -R`.                   |
| `--keymap <default\|vim>` | Key bindings. Also set by `JJ_COMPOSE_KEYMAP`.               |
| `--raw`                   | Start in the raw text editor instead of the form.            |
| `--diff-tool <NAME>`      | Tool `o`/`O` open the diff in. Also `JJ_COMPOSE_DIFF_TOOL`.  |
| `--ignore-immutable`      | Allow rewriting protected history. See below.                |

The revset must resolve to exactly one mutable revision; immutable ones are
rejected before the TUI opens. It's resolved once, at launch, so `@-` or a
bookmark can't drift to a different change while you're writing.

Saving runs `jj describe` on that change by its change ID, so it still finds the
right change if you edit files while jj-compose is open (jj rewrites the commit
when it snapshots your edits). Saving a message identical to the current one
does nothing.

## The message

```text
type(scope)!: subject

Free-form body text.

Problem:
What is wrong or missing.

Solution:
How this change addresses it.

Fixes #42
Reviewed-by: Name <email>
```

Only the header is required. A `!` at the end of the Type field marks a breaking
change and is written after the scope. Trailers are the final paragraph of
`Token: value` or `Token #value` lines (`BREAKING CHANGE:` included); they are
checked when you save.

The Subject title shows the header's length: green up to 50 characters, yellow
up to 72, red beyond.

### Revising existing descriptions

On launch the revision's current description is loaded. It opens in the form
**only if the form can reproduce it byte for byte**; otherwise it opens in the
raw editor, unchanged, and the status bar says why (for example, the first line
isn't `type(scope): subject`). Opening and saving a message never reshapes it
behind your back.

`Ctrl-t` switches between the form and the raw text at any time. Switching to
the form from raw text follows the same rule, so it's refused (with the reason)
until the text fits. Saving from the raw view writes the text exactly as typed,
without Conventional Commit validation.

## The diff pane

The diff is shown in git format with jj's colors, so your jj color settings
apply, but `ui.diff-formatter` does not. Each file starts with a title row
giving its path and how many lines were added and removed. The pane's title
shows which file is at the top, how many there are, and the current search.

- **Files and hunks:** `]` / `[` jump to the next / previous file, `}` / `{` to
  the next / previous hunk. `f` shows a list of every file with its counts down
  the side of the pane.
- **Search:** `/` opens a prompt in the status bar; `Enter` jumps to the first
  match, `n` / `N` move between matches. Searches ignore case unless they
  contain a capital letter.
- **Zoom:** `z` gives the diff the whole window, until you move back to the
  form.
- **Splitting:** `s` (or `Alt-s` from the form) reads the change one hunk at a
  time and marks the ones to commit together, so each piece gets its own
  message. See [Splitting a change]#splitting-a-change.
- **Stale diff:** when you're describing `@`, editing a file that's in the diff
  (in another terminal or your editor) flags the pane `stale: r to reload`
  within a second. `r` reloads it and keeps your place and search. New files
  that weren't in the diff show up on the next reload.

On terminals narrower than 100 columns the diff sits above the form instead of
beside it, and moving between the two follows the layout on screen.

## Keys

### Everywhere

| Key                 | Action                                |
| ------------------- | ------------------------------------- |
| `Ctrl-s`            | Save and run `jj describe`            |
| `Ctrl-c`            | Quit (asks again if there are edits)  |
| `Ctrl-t`            | Switch between form and raw text      |
| `Alt-s`             | Start splitting the change            |
| `Tab` / `Shift-Tab` | Next / previous field, then the diff  |
| `Alt-←` / `Alt-→`   | Jump to the diff / back to the editor |
| `PgDn` / `PgUp`     | Scroll the diff half a page           |
| `Alt-↓` / `Alt-↑`   | Scroll the diff one line              |

### Moving between boxes

The form is laid out with Type and Scope side by side above Subject, and the
other fields below. Moving past the edge of a field's text goes to whatever is
next to it on screen:

```text
 diff  │  Type  ⇄  Scope          diff (narrow terminals)
       │      Subject              ──────────────────────
       │      Body                   Type  ⇄  Scope
       │      ...                        Subject
       │      Trailers                   ...
```

- From Type or Scope, down goes to Subject; up from Subject returns to whichever
  of the two you left last.
- The diff is reached by going left from the start of a field, or up from Type
  or Scope on narrow terminals.
- Entering a field from the side puts the cursor on the side you came from.

Tab and `Enter` always follow the plain top-to-bottom order.

### Default keymap

The form opens ready to type in Type.

| Key                                    | Action                                                        |
| -------------------------------------- | ------------------------------------------------------------- |
| `Enter`                                | Next field (one-line fields) or newline                       |
| Arrows at a field's edge               | The field in that direction (←/→ only between Type and Scope) |
| `Esc`                                  | Quit (asks again if there are edits)                          |
| `Shift`+arrows                         | Select                                                        |
| `Ctrl-x` / `Alt-w` / `Ctrl-y`          | Cut / copy / paste (internal clipboard)                       |
| `Ctrl-z` or `Ctrl-u` / `Ctrl-r`        | Undo / redo                                                   |
| `Ctrl-←` / `Ctrl-→`, `Alt-b` / `Alt-f` | Word left / right                                             |
| `Ctrl-w`, `Alt-Backspace` / `Alt-d`    | Delete word before / after                                    |
| `Home` / `End`, `Ctrl-a` / `Ctrl-e`    | Line start / end                                              |
| `Ctrl-k` / `Ctrl-j`                    | Delete to end / start of line                                 |

The arrow keys never move you into the diff, so holding one down can't leave the
form; use `Alt-←` or Tab for that.

Pasting from the terminal inserts text as-is; in one-line fields newlines become
spaces.

### Vim keymap

`--keymap vim` or `JJ_COMPOSE_KEYMAP=vim`. Starts in Insert mode for a new
description and Normal mode when revising one; the status bar shows the mode.
Insert mode uses the default keymap's editing keys.

| Key                                                 | Action                                |
| --------------------------------------------------- | ------------------------------------- |
| `h` `j` `k` `l`, `w` `b` `e`, `0` `^` `$`, `gg` `G` | Motions                               |
| `h` `j` `k` `l` past the edge of a field's text     | The box in that direction (see above) |
| `Enter`                                             | Next field                            |
| `i` `a` `I` `A` `o` `O`                             | Insert                                |
| `x` `D` `C` `S` `J`                                 | Edit                                  |
| `d` `c` `y` + motion, `dd` `cc` `yy`, `p` `P`       | Operators and paste                   |
| `v` / `V`                                           | Visual / visual line                  |
| `u` / `Ctrl-r`                                      | Undo / redo                           |
| `Ctrl-d` / `Ctrl-u`, `Ctrl-e` / `Ctrl-y`            | Scroll the diff                       |
| `q`                                                 | Quit (asks again if there are edits)  |

### Diff pane

| Key                          | Action                                                       |
| ---------------------------- | ------------------------------------------------------------ |
| `j` / `k`, `↓` / `↑`         | Scroll a line                                                |
| `Ctrl-d` / `Ctrl-u`, `Space` | Half page                                                    |
| `g` / `G`, `Home` / `End`    | Top / bottom                                                 |
| `]` / `[`                    | Next / previous file                                         |
| `}` / `{`                    | Next / previous hunk                                         |
| `f`                          | Show / hide the file list                                    |
| `/`, then `n` / `N`          | Search, next / previous match                                |
| `z`                          | Zoom the diff to the whole window                            |
| `r`                          | Reload the diff                                              |
| `H` / `L`, `←` / `→`         | Pan sideways                                                 |
| `l`, `Esc`, `Enter`, `i`     | Back to the editor                                           |
| `s`                          | Start splitting the change                                   |
| `o` / `O`                    | Open the current file / the whole change in an external tool |
| `q` (Vim keymap)             | Quit (asks again if there are edits)                         |

---

## Splitting a change

A change that does three things needs three messages. `Alt-s` (or `s` in the
diff pane) fills the pane with one hunk at a time so each can be read on its
own, and you mark the ones that belong together.

Moving decides nothing, and nothing is final until you commit. Hunks go into
numbered boxes, one per commit you mean to make, and you can move a hunk between
them or take it out again right up to the split:

| Key                             | Action                                                     |
| ------------------------------- | ---------------------------------------------------------- |
| `1`–`9`                         | Put this hunk in that commit                               |
| the same digit again, or `0`    | Take it back out                                           |
| `n` / `p`, `}` / `{`, `→` / `←` | Next / previous hunk                                       |
| `g` / `G`                       | First / last hunk                                          |
| `a` / `d`                       | Put the rest of this file in the same commit / take it out |
| `e`                             | Divide this hunk, to send its lines to different commits   |
| `f`                             | Show the whole change as a list                            |
| `V` / `v`                       | Open the list, selecting from this hunk (see below)        |
| `Enter`                         | Done planning; go write the messages                       |
| `Esc`, `q`                      | Leave split mode, discarding the plan                      |
| `j` / `k`, `Ctrl-d` / `Ctrl-u`  | Scroll inside a hunk taller than the pane                  |

**The numbering is the order.** Boxes are committed lowest first, so putting a
hunk in commit 1 makes it the earliest commit regardless of where it sits in the
diff. That is how you order a decomposition so each commit builds.

The title carries the whole plan while only one hunk is on screen:

<p align="center">
  <img src="https://raw.githubusercontent.com/saylesss88/jj-compose/main/assets/jj-compose-title.png"
       alt="jj-compose-title" width="600">
</p>

A digit per hunk + different colors per commit, `·` for one staying behind, and
brackets round the hunk you are looking at.

`f` swaps the single hunk for the whole change at once, which is usually how you
work out what belongs together:

<p align="center">
  <img src="https://raw.githubusercontent.com/saylesss88/jj-compose/main/assets/jj-compose-hunks.png"
       alt="jj-compose-hunk" width="500">
</p>

Each file heading carries its totals and how many of its hunks are spoken for —
`1 of 3 assigned` is what tells you a file you thought you had finished still
has something left in it. Each hunk row gives its commit, its line number, its
size, and the definition it sits in.

The cursor in the list and the hunk on screen are the same cursor, so `j`/`k`
move both and every assigning key works the same in either view. `Enter`, `f` or
`Esc` goes back to reading whichever hunk the cursor was left on.

### Selecting a run of hunks

Twenty hunks shouldn't need twenty keystrokes, so the list has Vim's visual line
mode. `V` (or `v`) starts a selection at the cursor, moving stretches it, and
one digit assigns all of it.

| Key                            | Action                                               |
| ------------------------------ | ---------------------------------------------------- |
| `V` / `v`                      | Start or cancel a selection                          |
| `j` / `k`, `Ctrl-d` / `Ctrl-u` | Stretch it a hunk / half a page                      |
| `]` / `[`                      | Stretch it to the next file / back to a file's start |
| `g` / `G`                      | Stretch it to the first / last hunk                  |
| `o`                            | Jump to the other end of the selection               |
| `1`–`9`                        | Put the whole selection in that commit               |
| `0`, `d`, `x`                  | Take the whole selection back out                    |
| `Esc`                          | Cancel the selection; a second `Esc` closes the list |

`V G 1` puts everything from the cursor down in commit 1. Two things differ from
`a`: a selection is a run in diff order, so it can span files, and the digit
toggles. If the whole selection is already in that commit it comes back out.
Using it ends the selection, as in Vim. Counts like `20j` aren't available,
since the digits name commits; `]`, `G` and `Ctrl-d` cover the same ground.

### Dividing a hunk

Two unrelated edits on neighbouring lines land in the same hunk, and then no
amount of moving hunks around will separate them. `e` opens the hunk being
looked at so each of its `+`/`-` lines can go somewhere of its own; `e` again
closes it.

| Key                          | Action                                  |
| ---------------------------- | --------------------------------------- |
| `1`–`9`                      | Put this line in that commit            |
| the same digit again, or `0` | Take it back out                        |
| `j` / `k`, `n` / `p`         | Next / previous line                    |
| `g` / `G`                    | First / last line                       |
| `v` / `V`                    | Select a run of lines (see below)       |
| `e`                          | Close it; lines that agree fold back up |
| `Ctrl-d` / `Ctrl-u`          | Move the cursor half a page             |

The lines are shown in the order they will be written, which is not quite the
order `jj diff` prints them in: git groups the removals and then the additions,
and a divided hunk pairs each removal with the addition replacing it. A line no
commit takes is struck through, so what is left behind is as visible as what is
taken.

```text
┌ Divide wvkqrwwn · hunk 2/4 · src/app.rs · 11·· · 2/4 taken ─┐
│ fn run() {                                                  │
│-    let cnt = 0;                                            │
│+    let count = 0;                                          │
│-    if cnt > 1 {                                            │
│+    if count >= 1 {                                         │
│ }                                                           │
└─────────────────────────────────────────────────────────────┘
```

In the `f` list a divided hunk is marked `*` with a count of its lines, since it
is in no one box:

```text
│ src/app.rs  +2 -2  1 of 2 assigned              │
│ *   1    +1   -1  impl App  2 of 4 lines        │
```

**The lines start out going wherever the hunk was going**, which is the quick
way to carve one line out of an otherwise coherent hunk: press `1` to put the
whole hunk in commit 1, _then_ `e`, and every line is already in commit 1 — now
`0` on the one line that doesn't belong. Dividing decides nothing by itself, and
a division you open and undo leaves no trace.

Lines are the smallest unit: there is no taking half a line. A `-` and the `+`
replacing it are two separate choices, so taking the `+` without the `-` leaves
both lines in the file — the untaken one isn't struck through, which is how you
see it.

#### Selecting a run of lines

Changes come in pairs, so most decisions cover two adjacent lines. `v` (or `V`)
starts a selection at the cursor, moving stretches it, and a digit puts the
whole run in that commit:

| Keys                | Effect                                              |
| ------------------- | --------------------------------------------------- |
| `v j 1`             | This line and the next to commit 1 — a renamed pair |
| `V G 2`             | From here to the end of the hunk, to commit 2       |
| `v ... 0`, `d`, `x` | Take the whole selection back out                   |
| `o`                 | Jump to the other end of the selection              |
| `Esc`               | Drop the selection; again to leave split mode       |

A digit ends the selection once it has been used, as in Vim. A selection half in
a box is made whole rather than flipped line by line, so pressing the same digit
twice always ends where it started.

A division is not limited to two commits: the lines of one hunk can go to as
many boxes as you like, and the plan survives each commit the same way a
whole-hunk plan does. Once the lines still waiting all agree on one box, the
hunk simply goes there whole and stops being divided.

### Writing the messages

`Enter` hands the keys back to the form, which describes one commit at a time.
Write the message for commit 1 and press `Ctrl-s`: jj-compose makes it, reopens
on what's left with an empty form, and moves to commit 2. The status bar tracks
where you are, `Describing commit 2 of 3: 2 hunks`, and shows
`^s commit 2 hunks` instead of `^s save` while a split is pending. `Alt-←` goes
back to the hunks to change the plan.

The form starts out holding the original description, which carries over to the
remainder exactly as `jj split` does; clear the parts belonging to the commit
you just made.

A few edges:

- Whatever you leave unassigned stays behind in the final change, which you
  describe last.
- Putting every hunk in one box leaves nothing behind, so that's a description
  rather than a split, and `Ctrl-s` behaves as it does outside split mode.
- A binary file has no hunks, so its change always stays with the remainder.
- The last box needs no split of its own: once everything else is committed,
  what's left _is_ that commit.

## Rewriting released history

<!--prettier-ignore-->
> [!WARNING]
> **Do not rewrite commits that others rely on.** Since jj marks pushed commits
> as immutable, this flag exists to let you rewrite them. Only do this if you
> are absolutely certain no one else has pulled these commits, and be prepared
> to forcefully push the rewritten tags.

By default a revision jj protects as immutable: a tagged release, anything on
trunk, is refused before the TUI opens. `--ignore-immutable` passes jj's own
flag of that name through to every command, so such a revision can be split like
any other.

Two things happen when you do, and jj-compose can reverse **neither**:

- **Every tag on that revision or after it is stranded**, left pointing at a
  commit that is now hidden. Splitting is worse than describing here: one commit
  becomes two, so there is no mechanical answer to where the tag belongs.
  jj-compose suggests the remainder, since that is the commit holding the whole
  of the original content. Tags on _ancestors_ are untouched.
- **Every later commit gets a new hash**, because jj rebases the descendants.

So the mode is loud about it. The pane title carries `· immutable` for the whole
session, the status bar names the tags at risk before any work is done, and on
exit jj-compose prints what to run:

```text
Rewriting immutable history left these tags behind:

  jj tag set v0.1.0 --allow-move -r oxuonltl    # was 0688276c (feat: three things at once)
  git push origin v0.1.0 --force
```

The `git push` is there because `jj git push` cannot force-push a tag; that one
step has to go through git.

Think twice before using this on anything already published. If a release is on
crates.io, rewriting its commit makes your history disagree with the tarball,
and you then maintain that disagreement through force-pushed tags and a
regenerated changelog. The honest use is a release made minutes ago that nobody
has pulled, and for that, `jj op restore` is usually cleaner still, since it
rolls the tag back too instead of leaving you to re-anchor it.

## External diff tools

`o` opens the file at the top of the pane in another program; `O` opens the
whole change. Both run `jj diff --tool`, so the tool is whatever `--diff-tool`
says, and otherwise jj's own `ui.diff-editor`: a working `jj split` setup needs
no extra configuration here. The status bar names the tool that `o` will use.

`jj diff --tool` takes its arguments from `diff-args`, while `jj split` uses
`edit-args`, so a tool configured only for splitting needs the one line:

```toml
# ~/.config/jj/config.toml
[ui]
diff-editor = "meld"

[merge-tools.meld]
program = "meld"
edit-args = ["--newtab", "$left", "$right"]
diff-args = ["--newtab", "$left", "$right"]   # for `o`/`O`
```

A GUI tool returns to the form as soon as you close its window. A terminal tool
such as `difft` is paged by jj, so quit the pager (`q`) to come back. With no
tool configured at all, `o` says so rather than opening jj's internal diff,
which is the one already on screen.

`ui.diff-editor` is sometimes set to something that only makes sense for
splitting, such as a script wrapping `git add -p`. That isn't a viewer, so `o`
would pick it up and do nothing useful. Set `--diff-tool` or
`JJ_COMPOSE_DIFF_TOOL` to a real diff viewer in that case.

## License

[Apache-2.0](https://github.com/saylesss88/jj-compose/blob/main/LICENSE)