Archived documentation. This historical release predates the Cobalt rename. Its executable, configuration paths and package names use the former product name. For current Cobalt usage, consult the latest release. Current Cobalt documentation.
Editor reference¶
Detailed keybindings, editing semantics, workspace behavior, and development checks for Ches.
Startup defaults¶
ches PATH starts with the Vim Classic (vim-classic) colour scheme in
Zen: the document retains its frame, while status and supporting workspace
tiles are suppressed. This is separate from borderless Bare mode.
Space v ztoggles Zen/Workspace;--workspacestarts directly in Workspace.--bare(alias--superzen) starts borderless and takes priority over the Zen default and--workspace.Space v Btoggles Bare; startup Bare returns to Workspace when disabled.--theme NAMEoverrides Vim Classic;Space v Tchanges themes during use.- Tile hotkey hints, including those in Tile Terms, are hidden by default.
In editor Normal mode,
Space v ?toggles them for the session.
Floating terminal¶
The floating-terminal system is called Tile Terms. In Normal or Insert mode,
press Space /, or choose Toggle Tile Term in the command
palette. Ches lazily starts an interactive $SHELL (falling back to /bin/sh)
inside a real pseudo-terminal. Its initial directory is the current file's parent,
or the focused directory browser's directory. Changing files afterwards does not
change the running shell's directory; use cd in the shell.
Numbered terminal sessions¶
Prefix the toggle with a positive count to choose a separate cached terminal:
3 Space /opens terminal 3;4 Space /opens terminal 4.- Uncounted
Space /toggles the most recently selected terminal (initially 1). - Selecting the already-visible number hides it. Selecting a different number switches directly to that terminal in the same floating window.
- These toggles work directly in editor and terminal Insert mode, as well as
Normal mode and terminal Visual mode; no preliminary
jkis needed.
Each terminal has its own shell PID, environment, working directory, jobs, screen, exit status, and preferred size. It starts only on first opening, in the then-current file/browser directory; explicit shell restarts reuse that initial directory. Numbers are sparse identifiers, so opening terminal 4 does not launch 1–3. The window title shows Tile Term N.
Hidden terminals stay running and continue consuming output without taking focus.
Reopening a live terminal enters Insert; an exited terminal retains its final
screen until Normal r restarts that terminal alone. All terminals are retained
for the current Ches session and cleaned up when Ches exits; they are not restored
across editor restarts.
The terminal floats over the existing workspace, including bare and zen modes.
It initially prefers a 132×40 outer frame and shrinks to fit. Its shell receives the actual
content dimensions. If fewer than 20 columns or 6 rows are available, Ches refuses
to open it, or hides an already-open terminal. The shell keeps running while hidden
and continues consuming output; reopen with Space / after making room.
The floating terminal has its own Insert, Normal, and Visual modes, independent of the document's mode. Opening or reopening a live shell starts in Insert.
Universal toggle timing¶
In editor Insert and terminal Insert, Ches recognizes Space / and
N Space / with a 200 ms window between each successive key. A gap of
200 ms or more ends recognition. Normal/Visual mode keeps its usual untimed
leader/count bindings.
This requires a short typeahead delay for Space and potential number prefixes:
- A standalone Space or positive number is delivered after 200 ms of inactivity.
- A key that cannot continue the shortcut flushes the held text immediately, in order, before processing that key normally.
- A fast successful shortcut consumes the entire sequence. It does not insert
spaces, digits, or
/into the document or shell. - Type Space, pause at least 200 ms, then
/to enter literal/. Bracketed clipboard paste always bypasses recognition, including pasted2 /orjk. - Numbers start at 1; a standalone
0remains ordinary text. Multi-digit IDs work as long as each key arrives within the window and the number fits an integer.
Toggling from editor Insert preserves that mode: hiding the terminal returns you to typing in the original document. Switching terminal numbers routes pending text to its original owner, never to the newly selected shell. If the original buffer/session loses ownership before replay, the prefix is canceled rather than redirected. The timeout runs even when cursor animation is disabled.
Terminal size preferences¶
Ches retains a requested outer size for each numbered terminal in the current editor session, separately from the size that fits on screen. This is ordinary UI state, not a separate daemon or an on-disk preference. It survives hide/reopen, shell restart, file changes, and temporary screen-size clamps, but resets when Ches itself exits. Size commands affect the currently selected terminal, including while it is hidden. New terminal numbers start with their own default 132×40 preference.
| Context | Keys | Action |
|---|---|---|
| Terminal Normal/Visual | + or = |
Grow by 10 columns and 2 rows |
| Terminal Normal/Visual | - |
Shrink by 10 columns and 2 rows |
| Terminal Normal/Visual | Space t r |
Reset requested size to 132×40 |
| Editor Normal | Space t + / Space t - |
Grow/shrink terminal preference, even while hidden |
| Editor Normal | Space t r |
Reset terminal size |
Counts multiply the adjustment: terminal Normal 3+ grows by 30 columns and 6
rows; editor 3 Space t + does the same. The palette also offers Grow Tile Term,
Shrink Tile Term, and Reset Tile Term size.
Visible size changes take effect immediately and resize the child PTY. Hidden
changes apply when reopening. Requested size is bounded to 20×6–1000×500 and is
clamped to available screen space when displayed. Growing beyond the current
screen still changes the preference: enlarging the outer terminal later reveals
the requested size. Resizing in inspection preserves the frozen screen/selection;
i resumes the latest resized live grid.
Terminal Insert mode¶
Keys go to the shell, including Escape, Ctrl-\, Tab, Shift-Tab, arrows,
navigation/function keys, Ctrl-C, Ctrl-D, and Ctrl-Z. Escape remains available
to nested terminal applications. Rapid Space / and N Space / toggle/select
terminals directly, using the 200 ms matching window.
Ctrl-C interrupts the foreground job normally.
Type jk within 150 ms to enter terminal Normal mode. Neither character is
sent to the shell. A standalone j is held for up to 150 ms, then delivered even
if no more input arrives. A different next key flushes j before that key; slower
jk reaches the shell normally. Clipboard paste bypasses this shortcut, so pasted
jk remains literal text.
Alternatively, press Ctrl-Space to enter terminal Normal mode. Ctrl-@ is equivalent on
terminals that encode it as NUL. This freezes the visible screen for inspection;
the PTY keeps consuming output and the shell keeps running.
Clipboard paste supports Unicode, tabs, and line breaks and uses bracketed paste when the application requests it. Other control characters are filtered. Pastes exceeding roughly 1 MiB are dropped as a whole; interrupted pastes are drained without inserting their remainder into the editor.
Terminal Normal and Visual modes¶
| Keys | Action |
|---|---|
h / j / k / l, or arrows |
Move the inspection cursor |
w / b, 0 / $, gg / G |
Word, line, and screen navigation; counts supported |
v / V / Ctrl-v |
Characterwise / linewise / rectangular Visual selection |
o in Visual |
Swap selection endpoints |
y in Visual |
Yank selection to Ches's unnamed register and system clipboard |
yy in Normal |
Yank the current terminal row |
Escape |
Cancel selection or pending input, staying in terminal Normal |
Ctrl-Space |
Cancel selection and return to terminal Normal |
i / a |
Resume Insert and display the latest live screen |
Space / |
Hide the terminal and restore the previous available editor/view focus |
+ / = / - |
Grow/shrink terminal size; counts supported |
Space t r |
Reset terminal size to 132×40 |
r after shell exit/failure |
Start a fresh shell |
Selection is read-only and cannot change shell output or the edited document.
After hiding, use the editor's p / P to paste a yank. Characterwise, linewise,
and block yanks retain their kind; linewise copies include the terminal row's
padding spaces. Wide glyphs and combining marks are copied as whole characters.
Normal/Visual paste is swallowed rather than executed in the shell.
Inspection covers the screen captured when entering Normal mode, without
scrollback history. New output does not move the inspection cursor or change the
selected text. Resize clips the frozen grid around the cursor; returning to Insert
shows the latest resized live grid. The footer indicates the terminal-local mode.
Hotkey hints are hidden by default; toggle Space v ? in the editor before
opening a Tile Term to show its key guidance. Mode, exit status, and errors remain
visible with hints off, and hiding hints does not change PTY dimensions.
Hiding and reopening preserves the shell PID, environment, jobs, and screen. When
the shell exits, Ches retains its final screen and displays its exit status in
terminal Normal mode. Press r to start a fresh shell after exit or startup failure.
Reopening an exited terminal alone does not restart it. Quitting Ches shuts down
the terminal session and reaps its shell, escalating if children do not exit.
The implementation is Linux-only, with multiple cached numbered sessions and one
visible floating terminal at a time.
It supports UTF-8, wide/combining characters, ANSI/256/RGB colours, common text
attributes, and alternate screens through vendored libvterm 0.3.3, advertising
TERM=xterm-256color. There is no terminal scrollback browser, mouse forwarding,
docking, or shell-session restoration across editor
restarts. Use a program's own scrolling or a shell multiplexer when needed.
For a real-frontend check after building, run:
dune build -j 12 @scripts/smoke-embedded-terminal
This uses a private tmux server to check key delivery, persistent shell state,
paste, resize, interrupt, exit/restart, child cleanup, and outer-terminal recovery.
Backend details and focused checks are in terminal/README.md.
Keys¶
| Mode | Keys | Action |
|---|---|---|
| Normal | h j k l |
Move left, down, up, right; with a count, e.g. 20j, that many |
| Normal | w / b / e |
Next word start / previous word start / word end |
| Normal | W / B / E |
The same for blank-separated words |
| Normal | 0 / ^ / $ |
Line start / first non-blank / line end |
| Normal | _ / g_ |
First / last non-blank; with a count N, of the line N-1 below |
| Normal | gg / G |
First / last line, or line N with a count (20G) |
| Normal | % |
Matching (), [], or {} (see Matching delimiters) |
| Normal | ]n / [n |
Next / previous conflict region (see Conflict markers); with a count N, the Nth (3]n) |
| Normal | Space x u / l / a / b |
Keep the upper (ours) / lower (theirs) / both / base side of the conflict at the cursor |
| Normal | f / F / t / T + character |
Find character forward/backward, on/before it |
| Normal | ; / , |
Repeat the last find / repeat it in the opposite direction |
| Normal | / / ? then text and Enter |
Search forward / backward (literal, case-sensitive) |
| Normal | n / N |
Repeat the last search / repeat it in the opposite direction |
| Normal | * / # |
Search the small word under the cursor forward / backward |
| Normal | i / a |
Insert before / after the character under the cursor |
| Normal | I / A |
Insert at the first non-blank / end of the line |
| Normal | o / O |
Open a new line below / above, indented like this one |
| Normal | >> / << |
Shift current line right / left; a count selects lines (3>>) |
| Normal | d{motion}, dd, D |
Delete by motion, whole line(s), or through line end |
| Normal | diw |
Delete the small word under the cursor |
| Normal | x / X |
Delete character(s) under / before the cursor |
| Normal | y{motion} / yy |
Yank by motion / whole line(s) |
| Normal | p / P |
Paste the unnamed register after / before the cursor or line |
| Normal | v / V / Ctrl-v |
Start characterwise / linewise / blockwise Visual selection |
| Normal | Space v e |
Cycle retained problem details |
| Normal | Space v b |
Show/hide the read-only bottom problems preview |
| Normal | Space v f |
Switch problems preview between workspace/current document |
| Normal | Space v o |
Show/focus problems, or return to the document |
| Normal | Space v d / Space v D |
Show/hide, or show/focus, the static demo report (--demo-report only) |
| Normal | Space v m / Space v M |
Show/hide, or show/focus, the notification history |
| Normal | Space g g / Space g f |
Open the VCS view as a tab, or focus it where it is; from the focused view, back to the editor (see VCS view) |
| Normal | Space g t / Space g s / Space g h |
Move the VCS view to a tab / the split, or close it |
| Normal | Space g c / Space g a |
In a commit message opened from the VCS view (c): commit it / abort it |
| Normal | Space g l |
Show the current file's history in the VCS view, opening and focusing it (see Browsing history) |
| Normal | Space v R / Space v K |
Restart the diagnostic source (ocamllsp, slang-server, or --synthetic-checker), or crash the synthetic one (provisional keys) |
| Normal | Space l i |
Open live Language servers status; also search lsp in the palette |
| Normal (file) | K |
Hover: show server-provided type/documentation information |
| Normal (file) | gd / gD |
Go to declaration/interface / definition/source, with capability-aware fallback |
| Normal (file) | gr |
Find references, including declarations, in a searchable result picker |
| Normal/Insert (file) | Ctrl-k |
Manually request signature help; automatic help is independently configurable |
| Normal (file) | Ctrl-o / Ctrl-i |
Jump back / forward through symbol-navigation history |
| Normal (file) | Tab |
Jump forward alias for terminals that encode Ctrl-i as Tab |
| Normal | :e! then Enter |
Discard buffer changes and force-reload the file |
| Normal | Ctrl-e / Ctrl-y |
Scroll the view down / up a line, or N with a count |
| Normal | Ctrl-d / Ctrl-u |
Scroll view and cursor down / up half a screen, or N lines |
| Normal | zz / zt / zb |
Put the cursor line at the middle / top / bottom of the view |
| Normal | u / Ctrl-r |
Undo / redo |
| Normal | Space w |
Save focused file / apply focused directory edits |
| Normal | Space o |
Show file's parent in the main area (regardless of prior sidebar placement) / return to file |
| Normal | Enter / - / Space r (directory) |
Open cursor entry / parent / refresh clean listing |
| Normal | Space b n / Space b p |
Next / previous file tab (wraps) |
| Normal | Space b c / Space b C |
Close tab / force-close and discard retained text |
| Normal | Space b r |
Recreate missing file exclusively from retained text |
| Normal | Space b t / Space b s |
Show file buffers in the top strip / as passive status rows |
| Normal/Visual | Space m m/s/u/c/o (directory) |
Toggle mark / mark / unmark selection / clear marks / open marked files |
| Normal/Visual | Space d m/s/h/f |
Major / side / hide / focus browser or editor |
| Normal/Visual | Space d + / Space d - |
Grow / shrink side width by four columns; a count repeats (3 Space d +) |
| Normal/Visual | Tab (side directory) |
Return focus to editor (Insert Tab edits normally) |
| Visual | Enter (directory) |
Open files in intersected rows |
| Normal | Space q |
Quit; refused for dirty/missing files and hidden dirty directories |
| Normal | Space Q |
Quit, discarding unsaved changes |
| Normal | Space v c |
Toggle the centered tile / full width |
| Normal | Space v h / Space v l |
Move the tile 2 cells left / right; a count repeats (3 Space v l is 6) |
| Normal | Space v H / Space v L |
Move the tile 10 cells left / right; a count repeats |
| Normal | Space v - / Space v + (or =) |
Text width 10 cells narrower / wider; a count repeats (3 Space v + is 30) |
| Normal | Space v n |
Toggle absolute line numbers (Vim's number) |
| Normal | Space v N |
Toggle relative line numbers (Vim's relativenumber) |
| Normal | Space v s |
Toggle the animated smear cursor (off by default; launch with --smear to opt in) |
| Normal | Space v ? |
Show/hide tile hotkey hints (hidden by default) |
| Normal | Space v t |
Show/hide the status cell (shown by default) |
| Normal | Space v p h/l/k/j |
Place status left/right/above/below and show it |
| Normal | Space v p -/+ |
Shrink/grow requested status size by 2 cells (= aliases +); a count repeats |
| Normal | Space v z |
Toggle zen: hide status temporarily, retaining compact feedback |
| Normal | Space v B |
Toggle bare mode: borderless full-width document and quiet feedback |
| Normal | Space v T |
Open the live theme chooser (also Choose theme in the palette) |
| Normal | Space v r |
Reset workspace document placement; in bare, reset only its line numbers to off |
| Normal | Space c c |
Open the command palette (see Command palette) |
| Normal/Insert / Terminal modes | Space / |
Toggle the persistent floating terminal; timed in Insert (see Floating terminal) |
| Normal/Insert / Terminal modes | N Space / |
Select/open cached terminal N; uncounted toggle uses the last selected |
| Terminal Insert | Rapid jk or Ctrl-Space |
Enter terminal Normal mode |
| Normal | Space t + / Space t - / Space t r |
Grow / shrink / reset terminal size, even while hidden |
| Terminal Normal/Visual | Space / |
Hide terminal, keeping its shell alive |
| Terminal Normal/Visual | i / a |
Resume shell input |
| Terminal Normal/Visual | v / V / Ctrl-v, then motions and y |
Select and yank terminal text |
| Terminal Normal | r |
Restart an exited or failed shell |
| Normal | Space f l |
Fuzzy search current-document lines (including unsaved edits) |
| Normal | Space f f |
Find project files; open/activate retained buffers |
| Normal | Space f g |
Search project contents on disk; validate and jump |
| Normal | Escape |
Cancel pending input; when idle, clear search highlights and acknowledge the presented problem |
| Visual | motions, %, ]n / [n |
Extend the selection |
| Visual | v / V / Ctrl-v |
Switch the selection's kind, preserving its anchor |
| Visual | d / c / y |
Delete / change / yank the selected range |
| Visual | I / A |
On a block: insert before / append after it on every line; 2I repeats the text |
| Visual | > / < |
Shift selected lines right / left; a count selects indentation steps (3>) |
| Visual | Escape |
Cancel selection without moving the cursor |
| Insert | text, Backspace, Delete |
Edit |
| Insert | Enter |
New line, indented like the current one |
| Insert | Tab |
Insert spaces to the next multiple of 2 columns |
| Insert | Ctrl-t / Ctrl-d |
Increase / decrease current-line indentation by one step |
| Insert | Escape, or j then k |
Back to Normal mode |
| Both | Ctrl-c |
Nothing, except a hint to use Space q |
Movement stops at the ends of a line: h and l do not wrap to the next line.
j and k keep the column you were aiming for across shorter lines; every other
motion sets that column to where it lands, except that after $, as in Vim, j
and k stick to line ends. As in Vim, that column is a screen column, so j and
k line up on screen around TABs and wide characters, landing on whichever
character covers the column; on a TAB the cursor aims for the TAB's last cell
(its first cell in Insert mode, and in Visual mode at or before where the
selection started). Leaving Insert mode steps the cursor back one character,
as in Vim. Motions never change the text, the undo history, or [+].
Workspace status¶
File buffers default to a top strip when more than one file is open. Start with
--buffers status for rows inside the status tile, or switch using Space b s
(Show open buffers as status rows in the palette). Space b t or
--buffers top restores the strip. Status placement and size use the existing
workspace controls; if status is hidden or cannot fit, buffers fall back to the
strip. Zen hides both without changing the preference. Rows remain passive:
Space b n/p switches files through the same session lifecycle. Both presentations
disambiguate filenames and mark modified files with * and missing files with !
(rows also show [missing]). A constrained list follows the active file and marks
hidden neighbors with ^/v where space permits.
All installed tiles are shown at startup: the document, Status, Problems, and
History, plus the demo report when launched with --demo-report. Keyboard focus
starts in the document. The existing show/hide keys still toggle each tile.
Status can occupy a cell on any side of the document. It shows mode, file/dirty state, position, pending keys, and current feedback; it never takes keyboard focus. Side-by-side width starts at 28 cells, stacked height at 6 rows, and each requested size is remembered separately. Small windows fall back to the bottom status row; expanding restores the requested layout automatically. Wider windows never turn status on by themselves.
Zen keeps the bottom row for essential feedback without changing document placement
or saved workspace requests. Status controls used in zen update the saved layout;
toggle zen off to see it. Space v r still resets only document placement.
All settings are session-local. Save and reload failures remain visible across editing,
layout changes, compact status, and zen until acknowledged. An idle Normal-mode
Escape acknowledges the currently displayed problem and clears search highlighting.
Leaving Insert/Visual mode or cancelling a command, count, or search takes precedence;
press Escape again once idle to acknowledge. Acknowledgement leaves the problem active
and does not change dirty state. Status then shows an unresolved-problem count;
Space v e cycles retained details without retrying the operation. Repeated failure
renews attention without adding another entry. Successful save and reload resolve only
the corresponding failure for that file. Routine feedback, including refused quit,
clears on the next completed editor command or is replaced by newer routine feedback.
Pending prefixes, ignored keys, resize, and animation do not clear it.
Bare presentation¶
Start with ches --bare PATH (or its alias ches --superzen PATH), press Space v B, or choose Toggle bare mode
in the palette. Bare puts text at the terminal's top-left, using the full width
without a document border, title, padding, tab strip, workspace panes, or animated
cursor. Line numbers start off and can be enabled independently. Syntax highlighting, search and selection overlays,
modal editing, buffer switching, registers, and undo remain available.
Space v n toggles absolute numbering and Space v N toggles relative numbering,
using the same commands and gutter renderer as the workspace. Enabling both gives
hybrid numbering: the current line's absolute number and relative distances on the
other lines. The palette's number commands work identically. The gutter disappears
when the terminal is too narrow and returns with the chosen style when it grows.
Bare retains its own line-number preference for the session, across file switches
and leaving/reentering bare. It neither inherits nor changes the workspace/zen
number style. Space v r in bare resets only this profile to numbers off, leaving
workspace placement and numbering untouched. For code-level startup configuration,
Presentation.Bare_prefs.t holds these settings; for example,
Ui_state.create ~bare:true ~bare_prefs:{ line_numbers = Absolute } controller
starts bare with absolute numbers using the existing renderer. Preferences are
session-local and are not saved across launches.
The bottom row stays allocated so feedback never shifts the document. It is blank when idle, showing only pending keys, search/command prompts, and operation feedback rather than permanent mode, filename, dirty, or position fields. The cursor shape still distinguishes Normal and Insert mode. Diagnostic findings stay retained without an unresolved-problem count in this row; save/reload errors and other operation feedback remain visible until cleared or acknowledged normally.
Entering bare returns input from a supporting view or side directory to the
active file and releases floating capture and incomplete key sequences. A
directory-only session keeps its listing usable until a file is opened. The same
session owns the buffers in every presentation: switching does not reload files,
discard unsaved text, or reset undo. Space v B restores the previous workspace
or zen presentation and its requested layout; it returns to the file rather than
reactivating the previously focused supporting view. Other placement controls used
in bare update the saved workspace preferences while bare's effective geometry
stays stripped down; number toggles and reset target bare's own profile.
The palette and all three pickers can open over bare and return to it. Explicitly
opening or focusing a workspace view or directory browser leaves bare so the
requested surface can be displayed. Space v z explicitly selects zen instead.
Bare is a presentation choice; language-server startup still follows the usual
rules (--no-lsp disables it).
Command palette¶
Space c c opens a centered floating palette, listing every command that can run
from Normal mode with its shortcut (taken from the active bindings). Type part of a
command's name, or a related word: rel num, rln, and gutter relative all find
Toggle relative line numbers. Matching is fuzzy and in-process (no fzf needed):
each space-separated word must match, in order, in the title, the command's ID, or
one of its keywords, and matched title letters are highlighted.
The current default catalog contains 79 commands, including all three pickers,
VCS actions, Toggle tile hotkey hints, Toggle bare mode, and Choose theme.
Bare and workspace use the same global catalog: bare does not hide commands.
Commands local to a supporting view are added only when the palette is opened
from that view or its help. Some placement commands in bare update saved workspace
preferences; explicitly opening a supporting view leaves bare to display it.
| Palette keys | Action |
|---|---|
text, including Space and j/k |
Edit the query (a paste goes into it too) |
Backspace |
Delete the last character |
Ctrl-Backspace or Ctrl-w |
Delete the last word (most terminals send Ctrl-Backspace as Ctrl-h, which works too) |
Tab / Shift-Tab or Ctrl-n / Ctrl-p |
Select the next / previous command |
Enter |
Close the palette and run the selected command once, on the document |
Escape |
Close it without running anything |
Ctrl-c |
Show the host's reminder to use Escape; keep the palette open |
A command run from the palette behaves exactly as its key binding: an ordinary quit is still refused with unsaved changes, and save failures are reported the same way. The palette opens only from Normal mode, including in zen and bare. It is an opaque framed window above the workspace, not a bottom-band tile: opening, filtering, and closing do not reallocate the document, status, problems, report, or history tiles, or change the document scroll. Its preferred outer size is 80 columns by 14 rows, centered in the terminal and clamped with a one-cell margin where possible. Filtering does not change that size; results scroll inside the frame, with one bar cursor in the query.
It needs at least 14 columns and 4 rows for a frame, query, and one result row. Below that size it refuses to open with shared feedback. Resizing preserves the query and selected command while it still fits; if it cannot fit, it closes safely without execution and returns focus to the document. Closing restores the covered workspace and discards the query. Pasted text goes only into the query (line breaks become spaces); if the palette closes mid-paste, the rest is dropped even if the terminal grows before the paste ends. With no matching result, Enter leaves it open and reports that nothing matched. Opening from another supporting view still targets the document and returns there on cancellation.
To add a command, add an entry (ID, title, keywords, and the existing editor or view
action) to Catalog.default in palette/catalog.ml. Its shortcut is derived from the
bindings, so it needs no label and no execution code of its own.
File, document-line and project-content pickers¶
Space f l (Normal) or Search current document lines in the command palette
opens numbered in-memory lines in the shared float. Type loose subsequences;
Tab/Shift-Tab or Ctrl-n/p selects, Enter jumps to the earliest matched character and reveals it.
Backspace/Ctrl-w edit the query; paste is sanitized like the palette. Escape
cancels without moving the document; Ctrl-c shows a reminder, not cancellation.
Filtering/no-match Enter is inert. Document changes invalidate results; reopen to
refresh. Minimum 14×5, including zen; undersized resize closes safely.
Space f f / Find project files opens or activates retained buffers without
reloading unsaved text. Its file-only float prefers 175×40 (80×40 below 104 terminal
columns), centered and clamped with a one-cell margin where possible. At terminal
widths of 104 cells or more, its wider float
shows results left and a read-only numbered preview right (first 64 KiB/100 lines,
current unsaved buffer text if retained). Narrow terminals hide preview; it never
takes focus, opens tabs or changes Enter behavior. Loading/errors/truncation are
labelled. Space f g / Search project contents searches on-disk
case-sensitive literals, then validates the current target's entire raw line and
literal byte range before activating and revealing it. Dirty matching lines are
allowed; stale lines and missing new files fail visibly without changing tabs.
See picker status and setup for scope, limits, coordinates and ripgrep
dependencies. Existing / and ? search is unchanged.
Workspace commands include Save buffer, Next/Previous file tab, Close file tab (and its explicit discard variant), Recreate missing path, directory navigation, all five mark actions, and major/side/hide/focus/width actions. Save targets the owner from which the palette opened, including a side browser; it can permanently delete entries. Undo/Redo affect text only, not disk. There is no interactive open-path/save-as prompt; save-all is an application API, not a default binding or palette action.
Directory workspace¶
See the directory workspace reference for persistent tabs, placement/focus, visual and marked opening, identity tokens and filename escapes, copy/destination syntax, permanent empty-only deletion, missing-file recovery, cross-device limits, partial apply/retry and text-undo boundaries. Directory Save applies edits directly, without a confirmation dialog or filesystem undo.
Problems pane¶
Space v b toggles a bottom preview; Space v f switches workspace/current-file
filtering. Tile hotkey hints are hidden by default; Space v ? toggles them in
Problems, History, and the demo report, including focused lists and details, and
in Tile Terms and all picker/palette control footers. For text-input floats, toggle before opening
or use Toggle tile hotkey hints in the palette; captured keys still edit queries.
Overflow counts, detail positions, picker status, errors and action feedback remain visible.
Space v o shows and focuses the pane. It remains read-only:
| Pane keys | Action |
|---|---|
j/k, gg/G, Ctrl-d/u |
Select problems; move the text cursor while inspecting details |
yy / Y |
Copy the selected problem's whole description |
e |
Toggle full wrapped details for the selected problem, as read-only text (below) |
a |
Acknowledge only the selected problem, without resolving it |
Enter |
Jump to a valid current-file location and return to the editor |
Escape |
Cancel a prefix, end a selection, close details, then return to the editor |
Tab or Space v o |
Return directly to the editor |
Space v … |
Layout controls; editor commands and document scrolling are rejected |
Supporting views (problems, the demo report, and a dedicated status cell with room
for it) share one rounded, padded frame with their title in the top border and key
hints, notices, or a pending prefix in the bottom border; side-by-side tiles are
separated by a one-cell gap. The bottom band takes up to ten rows, never more than a
third of the window. Frames sit on the dark backdrop, so their rounded borders alone
separate tiles. The
> marker, the Problems* title, and an accent-coloured
frame show selection/focus; the terminal cursor is hidden in a pane's list and marks
the text cursor in its details. Hiding, zen, or resizing too small returns focus
to the editor. Pane pastes are ignored atomically, not treated as commands.
Focus, Escape/Tab/prefix precedence, workspace bindings, and paste ownership come
from the shared tile host (tile/), not the problems pane; any other supporting
view gets the same rules.
Missing/out-of-range locations and cross-file jumps are explained without touching the
document. Currently save/reload failures have no locations; location navigation
can be tried with language-server diagnostics or the opt-in synthetic demo below.
Cross-file jumps are not supported.
To try navigation on a file with several lines:
dune exec ches -- --demo-problems PATH
Press Space v o, then G to select the last demo finding and Enter to jump to
the file's last line. Refocus with Space v o; try gg and j/k to navigate,
or G then e to inspect the long final finding (j/k scroll details;
Escape closes them).
The flag adds eight clearly labelled DEMO entries, initially acknowledged so they do not demand failure attention. It does not change your text or write files; normal editing/saving still works. Entries are session-local and disappear on restart without the flag. Their locations are a startup snapshot, not refreshed after edits/reload. Short/empty files have repeated locations; use a multiline file to see distinct jump targets. No demo problems are added in an ordinary launch.
Demo diagnostics (checker findings fixture)¶
dune exec ches -- --demo-diagnostics PATH
This seeds static, labelled DEMO checker findings for reviewing the problems
view independently of a language server. It adds two sources on PATH (one
versioned, one unversioned, which reports a hint), a finding in another file, and a
stopped source whose finding stays marked [source stopped] (its stop warning is in
history). Findings are standing
state: they count in the status line ([N problems: Space v e]) but never take
attention or need acknowledging (a on one says so). The problems view lists
problems first, then findings by file, severity, and position. Findings for the open
file dim after an edit until their checker catches up; nothing updates the demo, so
they stay dimmed. Other files' findings never dim from typing. A finding's selection
survives lines inserted above it. Lists that arrive during Insert wait until it ends.
Language servers (ocamllsp and slang-server)¶
dune exec -j 12 ches -- PATH.ml # or .mli, .mll, .mly; --no-lsp turns it off
dune exec -j 12 ches -- PATH.sv # or .svh, .v, .vh; see Slang discovery below
Inspecting attached servers¶
Press Space l i, or open the palette and search lsp / Language servers.
The live read-only tab shows:
- Which managed servers are attached to the current file, or why none are listed.
- Every managed server's ID, workspace root, launch command, and attached files.
- Starting, Running, Stopped, or Unavailable, with the failure reason.
For example, opening both .ml and .sv files can show ocamllsp#1 and
slang-server#2 simultaneously. Several files can share a server when their root
and configuration match; distinct roots can have separate instances of the same
server. State comes from the managed processes, not from whether they reported
diagnostics. A server with zero findings can still be Running.
The report refreshes as files attach/close and servers start/stop. Reopening it
also requests a fresh inventory. Its current-file section uses the underlying
active file tab, so opening the report doesn't replace that context. Use the
usual read-only motions, v / V, and yank to copy information. Space b n /
Space b p switch tabs, and Space b c closes the report. With --no-lsp, it
reports that the diagnostic source is disabled; the synthetic checker is not
listed as a language server.
OCaml and pooled lifecycle¶
Like the owner's Neovim setup, ches starts ocamllsp from PATH for OCaml files. Its
root is the nearest ancestor containing any of dune-project, dune-workspace,
*.opam (a literal name), opam, esy.json, package.json, or .git; else the
file's directory. Diagnostics go
to the problems view and status count; Hints are their own, quieter severity.
ches never runs dune. Merlin needs a build's configuration, so in a project that has
never been built the only finding is No config found … Try calling 'dune build', and
errors from other files appear only while you run dune build --watch yourself.
ocamllsp 1.19 sends its lists unversioned, so open-file findings dim from your first
edit after a list arrives until the next one.
An unavailable server is recorded in history (Space v m) and the Language servers
report; a server that
exits or crashes is a one-off warning (ocamllsp stopped: … (Space v R to restart)),
kept in history, its findings kept dimmed and marked stopped; nothing restarts on
its own. On quit ches asks the server to shut down and waits up to 1 s.
--synthetic-checker replaces it. To check the client against the installed server
without the UI: dune exec source/bench/lsp_probe.exe -- -build.
Supported open files share one language-server process per workspace root and server
configuration. Switching tabs retains it; closing a file sends didClose for only
that document. The last close and session shutdown stop the process. Space v R
restarts each pooled server once and reopens all its current documents; Space v K
remains a synthetic-checker crash command. Document events retain buffer-generation
ownership, including inactive files. Each document has its own bounded revision/text
history, and monotonic wire versions map diagnostics back to editor revisions.
LSP source names carry a stable server-pool suffix (for example ocamllsp#1),
so one root/configuration stopping cannot dim another pool's findings. A restart
retains that ID; a new pool after the last close gets a new ID.
Edits keep only the latest pending snapshot per document. The first edit starts a
25 ms coalescing window; further typing replaces the snapshot without extending
that window. Diffing and JSON serialization happen at flush, rather than on every
key. Servers negotiating Full receive whole text; Incremental receives one
encompassing replacement against the last sent text, with UTF-8/UTF-16/UTF-32
positions as negotiated. Invalid UTF-8 or unknown position encoding uses a safe
full-text event; absent/None change support sends no changes. Save flushes its
document before didSave, including text if requested. Close, restart, and shutdown
cancel pending timers; initialization/restart opens the newest text. If the protocol
stream closes while the server remains alive, the client allows the configured
shutdown grace (normally 1 s), then reports the failure, kills and reaps the child.
Revision
history contains only sent versions (up to 32 per document).
Symlink paths stay separate LSP URIs and buffers. Two lexical names normalizing to
the exact same URI cannot independently hold unsaved texts: the second is explicitly
reported unavailable, and closing it cannot close the first. Late output for closed
URIs is discarded. A URI reopened while its pooled server survives receives normal
unversioned diagnostics using its current text and buffer ownership. These messages
carry neither a revision nor a buffer lifetime: late output from an old lifetime is
indistinguishable from fresh output and may temporarily replace current findings.
Versioned diagnostics still require a sent version in the current document's history;
old sessions and buffer generations remain isolated. The synthetic checker retains per-file
runtimes and per-file #generation source names. Directories do not start diagnostic drivers.
For SystemVerilog (.sv, .svh) and Verilog (.v, .vh), ches starts
slang-server with no arguments, using the same diagnostic and lifecycle
handling. Its root is the nearest ancestor containing .slang or .git; else the
file's directory. --no-lsp disables either server, and
--synthetic-checker takes precedence over either.
Slang executable discovery¶
Ches looks for the built-in Slang server in this order:
SLANG_SERVER, if set, as an explicit executable path or command name.slang-serveron PATH.$HOME/slang-server/build/bin/slang-server, if it is an executable file.
An invalid explicit override reports Unavailable rather than silently selecting
another server. The Language servers report shows the selected executable, root,
and any failure reason. This fallback supports a local Slang build without
changing your shell configuration; the separate slang compiler is not the LSP.
For an explicit launch:
SLANG_SERVER="$HOME/slang-server/build/bin/slang-server" ches path/to/design.sv
If no server is installed, follow the
upstream installation guide.
After making a missing executable available to the running Ches environment,
Space v R retries the managed servers. Environment changes made in another shell
require relaunching Ches to inherit them; executable selection is retained for
each existing server pool.
Set include paths, defines, and file lists in the project's .slang/server.json,
which the server reads itself. For example:
{ "flags": "-Irtl/include -DSIMULATION", "build": "build/top.f" }
See the slang-server configuration documentation. Ches consumes LSP diagnostics, completion, hover, declaration/definition navigation, and references, plus Slang active-instance selection and instantiation navigation. A full Slang hierarchy tree and waveform features are not wired into the editor.
Hover and symbol navigation¶
Place the text cursor on a symbol in a file's Normal mode:
| Key | Action |
|---|---|
K |
Show hover information in a scrollable floating view |
gd |
Request declaration first, then definition if unavailable or not found |
gD |
Request definition first, then declaration if unavailable or not found |
gr |
Find references in a searchable picker, including declarations |
Ctrl-o |
Jump back |
Ctrl-i / Tab |
Jump forward |
The same actions appear in the palette as Hover, Go to declaration, Go
to definition, Jump back, and Jump forward. Lowercase k remains upward
movement, and Space v K retains its synthetic-source test action. Tab's history
alias applies only to the Normal-mode file document; completion, snippets, pickers,
directory focus and terminals retain their own Tab behavior.
Hover displays the server's content, with lightweight Markdown formatting, readable
code blocks, and visible link text/URLs. In the popup, j/k or Ctrl-e/Ctrl-y
scroll a row, Ctrl-d/Ctrl-u scroll a page portion, and gg/G go to the ends.
q or Escape closes and returns focus. Long content is bounded and truncation is
marked. The popup does not execute links.
One navigation destination opens directly. Multiple destinations open a searchable picker; filter by path/line, use Tab/Shift-Tab or Ctrl-n/Ctrl-p to select, and Enter to jump. Escape cancels. Locations use the server's selected symbol range and negotiated UTF-8/16/32 encoding. Existing dirty destination buffers are reused; missing files or invalid positions fail without creating files or discarding edits.
For the inspected OCaml server, declaration asks Merlin for the interface (.mli)
and definition asks for implementation source (.ml). Actual locations depend on
symbol resolution and source availability. The implementation request is not used.
Slang advertises definition but not declaration, so both keys normally use its
definition handler. Hover can include elaborated types, widths, enum/parameter
values, and documentation according to server support. Instance-dependent results
reflect Slang's analysis; see active-instance controls below for selecting context
and the installed-server hover limitation.
Queries flush pending document changes before execution and are cancelled or ignored after cursor, mode, focus, buffer, document, or server-lifetime changes. Unsupported operations, no results, and failures produce notices rather than unexpected movement. A destination picker also rejects changed targets before acceptance; reopen the query to refresh it.
History records successful symbol jumps and preserves intervening cursor movement for reverse traversal. A new jump discards the forward branch. Each direction retains at most 128 entries, storing paths and byte offsets rather than snapshots. Edits do not relocate old marks: their numeric offsets are reused only if still valid, otherwise traversal reports an error without advancing history. History is session-local and navigation does not alter text undo history.
Find references¶
Press gr on a symbol in Normal mode, or choose Find references from the
command palette. This uses the standard LSP references request with declarations
included. It works with both ocamllsp and slang-server when advertised by the
attached server; it does not fall back to definition lookup.
All nonempty results open the Find references picker, even a single result. The heading shows matching/total counts. Filter by path/line, use Tab/Shift-Tab or Ctrl-n/Ctrl-p to select, and Enter to jump. Escape cancels. Jumps reuse retained dirty buffers and enter the same Ctrl-o/Ctrl-i history. Changed destinations are rejected rather than jumping to stale coordinates. Empty or unsupported queries produce a notice. The existing 256-target transport limit applies; oversized responses report an error rather than silently omitting results.
Source previews in result pickers¶
References and multiple-destination pickers include a Source preview below the results when there are at least eight content rows. Move through results with Tab/Shift-Tab or Ctrl-n/Ctrl-p to inspect source without opening each file. The preview shows line numbers and highlights the selected symbol range, including multiline and zero-width locations. It keeps the target line visible as the picker resizes; small allocations retain the result list without the preview.
Already-open buffers supply their current text, including unsaved edits; the header
identifies buffer rN or disk. Browsing previews never activates a buffer, starts
a language server, changes text, or adds jump-history entries. Enter performs the
usual validated jump; Escape cancels without moving the document.
Disk preview work is asynchronous, debounced by 40 ms, and limited to one physical read at a time. Rapid selection changes cancel or discard obsolete results. Loading, missing/unreadable files, unsupported text, stale targets and preview limits appear as explicit messages. Disk collection scans at most 8 MiB, retains at most 32 lines and 64 KiB, and copies at most 4096 bytes per line. Targets beyond the scan/line limits show a limit message; long surrounding lines indicate truncation. Previews highlight the target but do not apply language syntax highlighting yet.
File metadata is checked at result discovery, preview collection/delivery and navigation acceptance; retained buffers use document identity and revision. These checks catch ordinary replacements and edits, but cannot guarantee that a server's coordinates still refer to the same symbol after concurrent changes. A failed preview does not itself prevent an otherwise valid Enter navigation.
Slang active-instance context¶
With the cursor inside a module's definition in Normal mode, choose Select
active instance from the command palette (Space c c). Ches asks the server for
the enclosing module and lists its elaborated hierarchy paths. Search the list,
select with Tab/Shift-Tab, and press Enter to activate; * marks the previously
active path independently of the current picker selection. Escape cancels.
Activation changes server context only: it does not edit or navigate the file.
Confirmed context appears as Instance: top.some_instance in the status fields
when visible, in the selection notice, and alongside hover information for that
module. It is cleared when document/server context can no longer be trusted.
Hover, completion and navigation results from the previous context are invalidated;
other server pools retain their own state.
Choose Go to instantiation to navigate to the current instance's use site. This uses normal target validation and jump history, so Ctrl-o returns. If the server provides no usable location, Ches reports that instead of guessing. Some server versions return the module's own range for a top-level instance.
These commands require Slang's advertised extensions and an elaborated design with reachable instances. A standalone file may support hover/references but have no instance list until the server has a configured build/source set. Ches does not silently select a build file or change project settings. Unsupported servers and contexts receive a notice; there is no source-text module-name guessing.
Installed-server observation: the tested Slang 0.3.1+a7a2d08 confirmed
switching between top.narrow and top.wide, but subsequent fresh hover responses
still included both 8-bit and 32-bit type variants. Ches displays what the server
returns; active selection does not guarantee that this version narrows every
hover to a single width. Standard references worked in the same probe, and
ocamllsp returned the declaration and both uses of a test value.
Signature help¶
Signature help displays call information supplied by the attached language server,
with the current argument highlighted when the server identifies it. Automatic
help is enabled by default and follows the server's advertised trigger characters.
The installed ocamllsp advertises space, ~, ?, :, and (; Ches does not
infer calls from punctuation or parse language semantics itself.
- Ctrl-k in a file's Normal or Insert mode, or palette Signature help, requests help manually, even with automatic help disabled.
- Toggle automatic signature help changes the current session setting.
Use
Signature_help.set_enabled falseinconfig.mlfor a persistent preference. - While help is visible in Insert mode, Ctrl-g selects the next overload and Ctrl-b the previous. Tab and Ctrl-e/Ctrl-y retain completion/snippet behavior.
The overlay does not take focus or move the cursor. It shows bounded signature and documentation text, active-argument highlighting, and overload controls. It prefers above the cursor while completion appears below; in constrained space completion has priority. Movement, mode/focus changes, Escape, paste, snippet activation, configuration reload and server/context changes dismiss stale help. Automatic requests are suppressed while snippets, block insert, pastes, terminals or popups own input. Unsupported automatic requests remain silent; manual requests explain unavailability.
Current server support: the installed OCaml server returned signature help in
the live probe. The installed Slang version and inspected Slang source advertise
no signature-help provider, so this feature currently provides no SystemVerilog
function/task signatures. Hover (K) remains available there.
Switch OCaml interface/implementation¶
Choose Switch interface/implementation from the command palette to request
the current file's counterpart through ocamllsp. This switches companion files;
unlike gd/gD, it does not locate the symbol under the cursor.
A single existing counterpart opens directly. Multiple returned paths open a Choose counterpart picker. Retained dirty buffers and their cursor positions are reused; new files start at their ordinary initial position. Successful switches enter Ctrl-o/Ctrl-i jump history. Missing/unreadable counterparts report an error without creating a file or moving the current cursor. The server can return a suggested filename that does not exist, so absence is a normal possible outcome. Unsupported servers, including Slang, receive a notice; Ches does not guess filename extensions.
Code completion¶
The menu colors labels, source tags, type/detail strings and matched prefixes
separately. Selection uses a dedicated subdued background across the entire row,
and documentation uses the menu background. Detail text receives a semantic type
color rather than per-token syntax highlighting. Override individual colors with
Completion.set_color ~role ... in config.ml; see
completion menu colors.
Startup preferences can be set in OCaml configuration, including automatic completion, ghost preview, trigger length, and local-snippet priority. Palette changes last only for the current session; Reload configuration restores defaults plus the values in your file.
Automatic completion is enabled by default in ordinary Insert mode. After one
identifier character, a small menu offers matching words from the current buffer
and candidates from an attached language server. Punctuation ., :, >, and
/ also requests server suggestions. Buffer suggestions work without an LSP.
Ctrl-n explicitly requests completion in Insert mode, even with automatic completion disabled or with zero/one typed prefix characters. An empty prefix offers lexically ordered buffer words and available server candidates. The menu aligns candidate labels first, followed by aligned buffer/LSP source tags, and displays available kind, signature/detail, and selected-item documentation within the available space. One blank cell pads the right edge.
| Key | While candidates are available |
|---|---|
Tab |
Insert the selected candidate; subsequent presses cycle forward |
Shift-Tab |
Insert the selected candidate; subsequent presses cycle backward |
Enter |
Accept the selected candidate and close the menu, without a newline |
Escape |
Keep inserted text, close the menu, and return to Normal mode |
The menu stays open while cycling, and each choice replaces the original completion slot. Cycling wraps and freezes the available choices after the first insertion. Continuing to type accepts inserted text and updates suggestions. Additional edits, such as imports, apply only when finalizing the selected choice. Completion joins the current Insert undo transaction. Without candidates, Tab retains its normal behavior. Bracketed paste and block insert do not start completion.
Open the command palette (Space c c) and search for:
- Toggle automatic completion — turn suggestions off or back on.
- Toggle completion ghost preview — optionally show the selected candidate's untyped suffix; off by default. Only straightforward prefix matches get a ghost preview, and it never changes buffer text.
These toggles last for the current editor session. Buffer matches are case-sensitive and lexically ordered; LSP candidates use server sorting and precede buffer-only matches. Buffer-word indexing covers the entire document and is cached per live buffer; ordinary edits update only affected words. Large initial builds and updates run in bounded, yielded chunks outside input transitions. Snippet and LSP results remain available while word suggestions load, and word results cannot alter a candidate list already being cycled. Small buffers can finish in one bounded input step. The combined list is limited to 100 candidates. Typed-prefix scanning is limited to 4096 bytes, and buffer identifiers longer than 4096 bytes are omitted.
LSP requests synchronize the document first and discard obsolete replies. Insert/replace edits use the replace range; supported completion-list defaults are inherited by items. Selected candidates can lazily resolve documentation, details, and additional edits. Known additional edits apply at acceptance. If resolution is still pending, acceptance keeps the primary text and allows up to one second for extras to arrive while the accepted buffer/cursor remain unchanged. Any subsequent key or paste cancels this deferred action; typing never waits. Completion commands, indentation adjustment, commit-character acceptance, and dynamic capability registration remain unsupported.
Snippet placeholders¶
Language-server completions can contain snippet fields. Cycling with Tab inserts the expanded text but does not activate those fields. Enter accepts the candidate and activates its first numbered field, highlighting its default text and linked occurrences.
| Key | While snippet fields are active |
|---|---|
| Typing | Replace the selected default, then edit the field; linked occurrences update together |
Tab |
Select the next numbered field; after the last, move to the final cursor position and finish |
Shift-Tab |
Select the previous field; at the first, reselect it |
Ctrl-e / Ctrl-y |
Cycle the active field's choices forward/backward, with wraparound |
Left / Right |
Move within a field without losing linked updates; leaving it ends the snippet |
Home / End |
Move to the current line's start/end; retain the snippet only when still within an active occurrence |
Escape |
Retain expanded text, end the snippet, and return to Normal mode |
Ctrl-n |
End the snippet and explicitly request completion |
For example, a server snippet assign ${1:signal} = $1;$0 expands to
assign signal = signal;. Enter selects the first signal; typing ready
updates both occurrences, and Tab moves to the position after the semicolon.
Supported syntax includes $1, ${1}, ${1:default}, linked occurrences, $0
for the final cursor, and escaped backslashes, dollar signs, and closing braces.
When $0 is absent, the final cursor is at the end of the expansion. Choice fields
such as ${1|posedge,negedge|} initially select the first option and retain linked
occurrences. Within choices, escape comma, pipe, and backslash as \,, \|, and
\\; options can be empty or multiline.
A compact hint shows available choices while the field is active. Cycling keeps
the chosen value selected, so typing replaces it with custom text. After custom
text, Ctrl-e chooses the first option and Ctrl-y the last. For a quick hands-on
test in a SystemVerilog file, accept the bundled aff snippet with Enter, press
Ctrl-e to change posedge to negedge, then Tab to edit clk.
Filename variables work in local and language-server snippets: TM_FILENAME,
TM_FILENAME_BASE (only the final extension removed), TM_DIRECTORY, and
TM_FILEPATH. Use $TM_FILENAME, ${TM_FILENAME}, or a literal fallback such
as ${TM_FILENAME_BASE:untitled}. Paths are the current document's lexical editor
paths; relative paths stay relative and a bare filename has directory .. Missing
or unnamed paths use the fallback or empty text. Variables and defaults are not
recursively expanded. Unknown variables, transformations, nested numbered fields, and
conflicting linked defaults/choices are rejected; malformed completions are skipped.
Templates can come from the language server or the independent local catalog
described below.
For example, module ${TM_FILENAME_BASE:untitled};\n $0\nendmodule uses the
current filename without its final extension as the module name. A standalone
variable inserts literal text. For an editable filename-backed field, use
${1:${TM_FILENAME_BASE:untitled}}: its resolved value is selected and edits mirror
to $1. Numbered defaults may mix literal text and supported variables, for
example ${1:prefix_${TM_FILENAME_BASE}}. Nested numbered fields, nested choices,
transforms, and recursive variable fallbacks remain unsupported.
For a server-independent hands-on test, open the command palette from a file's
Normal mode (Space c c) and select Insert demo snippet. This development
utility inserts at the current cursor and activates signal immediately:
assign signal = value;
// mirror: signal
Type a name to update both signal occurrences, press Tab to edit value, then
Tab again to finish on the final empty line. Escape followed by u undoes the
expansion and field edits together. The action is included in the regular build,
needs no LSP, and works with automatic completion disabled. It is available in
file Normal mode, not directory/read-only views or block insertion.
Automatic completion is suppressed while editing snippet fields. Safe Left/Right/ Home/End movement clears the default selection and retains mirroring within the active field's occurrences, including their endpoints. Movement outside those ranges, paste, newline, buffer/focus changes, and edits crossing a field boundary end the snippet before normal handling. Expansion, internal movement and linked edits retain the Insert undo group; undo/redo does not reactivate a cancelled session.
Snippet acceptance uses additional edits already known at Enter and cancels pending resolve before activating fields. Late-resolved imports are therefore omitted for that acceptance, rather than shifting fields after editing has begun. Plain completions retain the deferred-resolution behavior described above.
Independent and user-defined snippets¶
Insert snippet in the command palette (Space c c) opens a searchable picker
from an editable file's Normal mode. It includes global templates and templates
matching that file's scope, independently of LSP or automatic completion settings.
Search by prefix, description, ID, or collection. Tab/Ctrl-n and Shift-Tab/Ctrl-p select the
next/previous result; Enter inserts and activates placeholders; Escape/Ctrl-c
cancels without changing the document. At sufficient height, the preview shows
the raw body, scope, collection, ID, and effective origin (bundled, legacy JSON, or OCaml).
Picker insertion is at the captured cursor, like i, and does not consume a
preceding identifier. Filename variables and indentation use that insertion
context. Editing fields and undo follow the same rules as accepted completion
snippets. Stale buffers or catalog reloads cannot insert an outdated selection.
Choose Open configuration to edit config.ml in Ches, save, then choose
Reload configuration to apply your changes. Existing unsaved config buffers
are reused; a missing file opens as an unsaved buffer without automatically
creating directories or files.
Local templates work without a language server, including with --no-lsp. They
appear as [snippet] candidates alongside LSP and buffer suggestions, with local
templates ranked first. Tab cycles expanded candidates; Enter activates fields.
Automatic matching starts after one character; Ctrl-n also works with automatic
completion disabled or an empty prefix.
The original starters remain available in .sv and .svh files:
| Prefix | ID | Template |
|---|---|---|
aff |
sv.aff |
Clocked always_ff block with a posedge/negedge choice |
acomb |
sv.acomb |
always_comb block |
mod |
sv.mod |
Module declaration with an editable filename-backed name |
inst |
sv.inst |
Module instance with a linked port/signal field |
genfor |
sv.genfor |
Generate loop with linked loop-variable occurrences |
The full catalog has 93 templates in seven collections: SV design and
verification; core OCaml, testing, and Jane Street conventions; and Hardcaml
design and verification. Hardcaml uses the same file types as OCaml. All
collections are enabled by default and can be toggled in config.ml, for example
Snippets.set_collection_enabled ~collection:"hardcaml.verification" false.
See snippet collections for triggers, configuration, timing/reset
semantics, and library dependencies. Collection names are searchable in the picker.
To customize, define templates with Snippets.add and Snippets.disable in
config.ml, then choose Reload configuration. Settings and declarations
are validated and applied together; any failure retains the last good state.
See the OCaml snippet API and
editable examples. Builtins remain available unless
overridden or disabled by ID.
Legacy JSON snippet collection¶
The earlier JSON configuration remains supported as an optional base layer beneath
OCaml declarations. To use it, create ~/.config/ches/snippets.json. If XDG_CONFIG_HOME is an
absolute nonempty path, Ches instead reads $XDG_CONFIG_HOME/ches/snippets.json.
Ches does not create or overwrite this file. The editable
example collection contains all five starters.
For example, this replaces the bundled aff with a falling-edge variant and adds
a global template:
{
"version": 1,
"snippets": [
{
"id": "sv.aff",
"prefix": "aff",
"scope": ["systemverilog"],
"description": "Falling-edge always block",
"body": [
"always_ff @(negedge ${1:clk}) begin",
" $0",
"end"
]
},
{
"id": "personal.todo",
"prefix": "todo",
"description": "TODO comment",
"body": "// TODO: ${1:description}$0"
}
]
}
ididentifies a template. A user entry overrides a bundled entry with the same ID; other bundled entries remain available.prefixis the case-sensitive completion trigger;descriptionis optional.scopeis an array:systemverilog(.sv,.svh),verilog(.v,.vh),ocaml(.ml,.mli), or explicit extensions such as.py. Omitted or empty scope makes the snippet global.bodyaccepts a string or an array of lines, using the supported placeholder syntax above. JSON string escaping applies in addition to snippet escaping.- Subsequent lines inherit the insertion line's leading whitespace, while keeping the template's relative indentation. Placeholders and mirrors are relocated accordingly. Only the typed prefix is replaced.
- To disable a starter, use an entry such as
{"id":"sv.aff","disabled":true}. Do not include body/prefix fields on a disabled entry.
The legacy file loads asynchronously at startup. After editing it, choose Reload snippets from the command palette. A malformed file or failed read reports an error and preserves the last good collection. A missing file uses the bundled starters as its base. Current OCaml declarations are reapplied after every legacy load, taking precedence. Reload replaces the base rather than accumulating entries; deleting an override restores its starter on the next successful reload. Files are limited to 1 MiB and 1000 user entries, and duplicate IDs/unknown fields are errors.
Synthetic checker (live diagnostic source)¶
dune exec ches -- --synthetic-checker PATH
This runs a synthetic checker through the same asynchronous source boundary as
the language servers, so freshness, crash, and restart behaviour can be tested
without an external server. It starts with the document, rooted at the nearest
directory with a dune-project (else PATH's directory). Like ocamllsp it is one
source, synthetic, running two checks and merging them into one list per file:
- an edit check, like merlin: about 0.4 s after an edit it checks the newest text: a
line containing
ERRORis an error, one containingTODOa warning. - a build check, like dune: about 0.8 s after a save (and at start) it checks the
saved text's
ERRORlines (synthetic build error) and adds a warning insynthetic_other.ml, a file you have not opened.
The open file's list describes the revision of the newest edit check, so its findings dim while you type ahead of it. As with dune, a build finding stays until you save.
Space v K crashes the checker. As in Neovim, that is a one-off warning
(synthetic stopped: … (Space v R to restart)), gone at the next command but kept in
history; nothing takes attention. Its last findings stay listed, dimmed and marked
stopped. Space v R restarts it; kept findings stay dimmed until the restarted
checker replaces them. There is no automatic restart. Without this flag, Space v R restarts all managed language servers, if present;
Space v K is available only for the synthetic checker.
Demo report (tile-system fixture)¶
dune exec ches -- --demo-report PATH
This installs a static, error-free report of ten labelled DEMO REPORT rows. It
exercises the shared tile host without the problems system. Space v d shows it in
the bottom band (beside problems when both are shown); Space v D focuses it.
j/k, gg/G, and Ctrl-d/u select, e or Enter toggles wrapped details (the
last row's details scroll), and Escape/Tab/Space v … behave as in problems.
Space v o and Space v D move focus between the two views. The report never
posts feedback, touches problems, or edits the file. Without the flag, Space v d
and Space v D only report that it is unavailable.
Notification history¶
Space v m shows the history in the bottom band (beside problems and the report);
Space v M focuses it, like :messages in Vim. It lists past feedback oldest first,
numbered #N: editor messages and keymap notices, and each problem's failures
(problem, problem again when it was still active) and resolutions. Layout
feedback and a view's own notices (such as a rejected paste) are not kept. An event
repeated back to back is counted on one entry (×3). The newest 200 entries are kept
in memory; the title counts any older ones dropped. Nothing persists across launches.
History is a record, not current state: problems live in the problems pane. Resolving
a problem adds a resolved entry and keeps the earlier failure. Clearing the history
leaves active problems alone. The focused list follows the newest entry until you move.
j/k, gg/G, Ctrl-d/u select, yy copies an entry, e/Enter opens it as
read-only text (below), and X clears the history. Escape, Tab, and Space v …
behave as in problems.
VCS view¶
Space g g opens a git view of the repository around the startup file (or the
directory opened), in the spirit of lazygit and Magit. It stages, unstages and
discards files, hunks and selected lines, commits, amends and extends HEAD,
fetches, pulls and pushes, checks out, creates and merges branches, carries a
merge or rebase that stopped on conflicts through to its end (see
Resolving conflicts), and browses the history of HEAD, a
branch, all branches or a file (see Browsing history). The view is a tab the
first time (labelled VCS:
<branch>, or VCS: <revision> on a detached HEAD); Space g s moves it into the
split beside the editor, Space g t back into the tab strip, and Space g h
closes it (its state is simply re-read when it opens again; the chosen log is
kept). It occupies one place at a time. Space g g and Space g f are the
same command: they open the view, activate its tab, or move focus between it and
the editor. The palette lists them as VCS: open or focus (vcs.open),
VCS: move to a tab, VCS: move to the split and VCS: close (vcs.to-tab,
vcs.to-split, vcs.close). Space s t/s/h also move it while it has focus.
The left column holds a head summary (branch, upstream and ahead/behind, and any
merge or rebase in progress) above three list panels: Files (Conflicted,
Untracked, Unstaged and Staged sections), Branches and Commits (the log
chosen with l, at first HEAD's latest 200 commits, with a graph). The diff panel
beside them follows the selection: a file's unstaged or staged diff, a section's
combined diff, or a commit's git show, which starts with the commit's file list. In a narrow placement,
such as the split, the lists stack above the diff; when even that does not fit,
only the focused part shows. @ shows the command log at the bottom: each git
command with its exit status and, on failure, its output (a fetch, pull or push also
keeps its last lines of output, and shows its progress while it runs).
| VCS keys | Action |
|---|---|
1 / 2 / 3 (list) |
Focus the Files / Branches / Commits panel |
0 (list), Tab |
Focus the diff; Tab again returns to the list it follows |
j k, gg G, Ctrl-d Ctrl-u |
Move in a list (headers included); the diff follows |
Enter (list) |
Fold or unfold a section header; on a file or commit, focus the diff; on a branch, check it out |
y (list) |
Copy the selected path, branch name or abbreviated commit hash |
s / u / x (Files) |
Stage / unstage / discard the selected file, or every file of the selected section |
x (a conflicted file, or its diff's header lines) |
Resolve it whole: take ours or theirs (marking it resolved), or restore its conflict markers; asks first |
s / u / x (diff) |
Stage / unstage / discard the hunk at the cursor; on a file's header lines, the whole file |
s / u / x (diff, Visual) |
Stage / unstage / discard the lines the selection touches (one file, any of its hunks) |
S / U (Files, diff) |
Stage all changes (not conflicts) / unstage all changes; also in Visual |
] / [ (diff) |
Next / previous hunk; with a count, 3] moves three, stopping at the last |
} / { (diff) |
Next / previous file; counts as for ] [ |
| Read-only text keys (diff) | Move, select and copy, as in Read-only text, with counts: 10j, 5k, 12G |
e, Enter (diff) |
Open the file at the cursor's line; Enter on a line of a commit's file list jumps to that file's diff instead |
l (list) |
Log popup: HEAD, a branch, all branches or a file's history, with switches |
+ (Commits) |
Read twice as many commits (up to 12800) |
c |
Commit popup: commit, amend or extend HEAD, with switches |
f |
Fetch from the default remote (git fetch --prune) |
p / P |
Pull popup / push popup |
m |
Merge popup for the branch selected in Branches; while merging, its popup: m commits the merge, a aborts it |
r |
While rebasing, its popup: r continues, s skips the commit being applied, a aborts |
n (Branches) |
New branch at HEAD, checked out: prompts for the name |
- (Branches) |
Check out the previous branch (git switch -) |
g r |
Refresh (or look for a repository again) |
@ |
Show or hide the command log |
? |
List the keys that work where the cursor is (also in the palette, first) |
q |
Leave: show the file tab, or return focus to the editor beside the split |
Escape |
In the diff: end a selection, then back to the list; in a list: return |
In the diff, digits belong to the text: 10j scrolls ten rows and 0 is the line
start, so 1/2/3 do not switch panels there. Tab or Escape returns to the
lists, where they do.
With hotkey hints on (Space v ?), the footer names only the keys that act where
the cursor is, after ? help, which lists them all: for example Files 1/4 | ? help,
s x S, Enter fold, Tab diff, c commit, p P pull/push, 2 3 panels, q on the Untracked
header, u x in Staged, s resolved on the Conflicted header, no staging keys in a
commit's diff and no line keys in Visual on a conflict. Each footer fits a 100-column
view; a narrower one cuts the end first.
A popup (such as c's) floats over the view, listing its switches and actions:
| Popup keys | Action |
|---|---|
- then a switch's key |
Toggle the switch (* marks an enabled one; one per group); in a popup without switches (Resolve, Merging, Rebasing) - is unbound and leaves nothing pending |
| An action's key | Run it with the enabled switches; the popup closes |
Escape |
Clear a pending -; otherwise close, running nothing |
q, Tab, Ctrl-c |
Close, running nothing |
? |
List the popup's keys; closing the list returns to the popup |
Space ... |
Workspace keys still work |
Switches start off at every opening, except in the log popup (l), which opens with
the current log's.
Staging and discarding. Each action runs as one git command (two for a hunk:
git apply --check, then the apply, with the patch on stdin), shown in the command
log, then the view refreshes. The selection stays on its row when the row is still
listed; a file that left its section (staged, discarded) gives way to the next file
of that section, else the previous one, else the section's header. After a hunk
action the diff cursor goes to the hunk that took its place in the same file (or the
file's last hunk). Specifics:
- A section header acts on every file of the section;
Sstages every unstaged and untracked file. What an action cannot apply to (a nested repository, a submodule's discard, ...) is left out and named in the title or question. son a conflicted file (or the Conflicted header) runsgit add, marking it resolved, without checking for leftover markers.xon a conflicted file resolves it instead of discarding (see Resolving conflicts);u,xon the Conflicted header ("Resolve conflicted files one at a time (x on a file); nothing ran") and hunk and line actions on conflicts ("Resolve conflicts in the editor: Enter opens the file at the conflict, Space x u, l, a or b keeps a side; nothing ran") are refused.xalways asks first; the default answer is No and onlyyconfirms. Discarding unstaged changes restores the file from the index; discarding an untracked file deletes it (git clean); discarding staged changes returns the file to HEAD in the index and the work tree, and is refused while the file also has unstaged changes.- While any file buffer inside the repository has unsaved changes, a discard is
refused before the question, naming the buffers ("... refused: unsaved changes in
a.txt; save or undo them first; nothing ran"), and checked again on
y. Staging a file whose buffer has unsaved changes stages the saved file and says so. - After a discard (even a failed one), open buffers inside the repository are compared with disk: unchanged buffers whose file changed are reloaded (cursor and scroll kept), those whose file is gone are marked missing. Staging and unstaging never touch the work tree.
- While an action runs and until the refresh after it arrives, further actions say
"Busy:
; nothing ran". A failed command is reported with git's message and its full output is in the command log ( @). - In a commit's diff there is nothing to stage.
]and[do not move in Visual.
Selected lines. In the diff of the work tree or the index, start a selection with
v or V and press s, u or x: the action takes every added or removed line
the selection touches (a line counts when any of its characters is selected;
context, @@ and header lines are ignored). Unselected removed lines stay, and
unselected added lines are left out. A selection across several hunks of one file is
one patch, checked with git apply --check and then applied, so either all of it
applies or nothing does. The title says how much: "Stage 2 lines of a.txt",
"Unstage 1 line of a.txt"; x asks "Discard 3 lines of a.txt? Their unstaged
changes are lost." (in the staged diff: "Discard 3 staged lines of a.txt? Their
changes are removed from the index and the work tree and lost."). Confirmations, the
dirty-buffer refusal, the staging warning, reconciliation and busy work as for hunks,
and the diff cursor goes afterwards to the hunk that took the place of the first
touched one. Refusals leave the selection in place so it can be adjusted:
- "Select lines within one file; nothing ran" when the selection reaches a second file (its header lines included).
- "No changes selected; nothing ran" when it holds no added or removed line.
- An untracked file: "Stage the whole untracked file first (s on its row); nothing
ran" (
u: "is not staged; nothing ran"). A binary, mode-only, rename-only, submodule or conflicted file has no line actions ("Line actions do not apply to : ...", or the conflict refusal). - A selection made before the files changed fails at the check and changes nothing.
Running an action, or asking about it, ends the selection whatever the answer.
Committing. c (in any panel, and in the diff outside a selection) opens the
commit popup. Its switches are -n (--no-verify: skip the pre-commit and
commit-msg hooks), -s (--signoff: add a Signed-off-by line) and -e
(--allow-empty); they start off at every opening. Its actions:
ccommits the staged changes andaamends HEAD with them (HEAD's message pre-filled; with nothing staged,ajust rewords HEAD). Both open the message file,.git/CHES_COMMIT_EDITMSG, as an ordinary file tab with the cursor on the first line, below which a#comment block names the branch, the switches and the staged files. At 80 columns or wider (and at least eight rows), the message editor occupies the right side while the VCS's files, branches and recent commits stay visible on the left.Space g gfocuses those lists without leaving the draft;Tabthere returns to the message. The diff preview returns when you finish, abort, or switch away from the message tab. Smaller terminals show the full-width message editor, and widening restores the lists. The VCS's tab, split or band placement is preserved. Write the message with the usual editing keys, thenSpace g c(paletteVCS: finish commit) saves the buffer and runsgit commit --cleanup=strip -Fon it (with--amendfor an amend, and the switches chosen in the popup): comment lines and surrounding blank lines are removed. On success the message tab closes (unsaved edits and all), the file is deleted, you are back in the VCS view where it is placed (if it was closed meanwhile, the editor shows the next tab), the view refreshes and git's summary line ([main 1a2b3c4] Subject) is reported.Space g a(VCS: abort commit) closes the message and deletes the file without committing ("Commit aborted", "Amend aborted"). A message tab closed by hand is simply forgotten; the nextc cwrites a fresh one.eextends HEAD at once:git commit --amend --no-editadds the staged changes and keeps HEAD's message.
Refusals and failures:
- Nothing staged: "Nothing staged; stage changes first (s), or allow an empty commit
(-e); nothing ran" for
cande(checked again onSpace g c). Conflicted files refuse every commit ("Resolve the conflicted files first ..."), and on a branch with no commits there is nothing to amend or extend. Space g candSpace g awork only in the pending message's buffer; elsewhere they say "No pending commit message here; nothing ran".c corc awhile a message is pending shows that buffer again: "A commit message is already open: Space g c commits it, Space g a aborts".- If git refuses (a pre-commit or commit-msg hook rejects the commit, or the message
is empty once comments are stripped), the message stays open and pending with the
failure reported ("Commit failed: <git's first line> (exit 1)"); the full output
is in the command log (
@). Fix the message and pressSpace g cagain, or abort and reopen with-nto bypass the hooks. - If the buffer cannot be saved, nothing runs and the message stays pending.
- While an action or a commit runs, commit keys say "Busy:
; nothing ran" (also Space g awhile its commit runs).
Commits never rewrite the work tree themselves, so unsaved buffers do not block them, but hooks may: after every commit, amend or extend, open buffers inside the repository are compared with disk as after a discard.
Remotes and branches. f, p, P, r and m work in any panel and in the
diff outside a selection; Enter, n and - in Branches. Every one goes through
the same steps as staging: refusals say why and run nothing, one command runs in the
background and is logged, and the view refreshes after it.
ffetches at once:git fetch --prunefrom the default remote, so an upstream deleted on the remote shows as gone.popens the pull popup:ppulls from the branch's upstream, fast-forward only (git pull --ff-only --no-rebase, whateverpull.rebasesays); with-rit rebases the local commits onto the upstream (git pull --rebase). A pull is refused on a detached HEAD, without an upstream ("push it with P u first"), with a gone upstream, with conflicted files, and while another operation is in progress.Popens the push popup, titled with the branch:ppushes to its upstream (named exactly, e.g.Push to origin/main, sopush.defaultnever matters),upushes toorigin/<branch>and makes that its upstream.-nskips the pre-push hook;-fforce-pushes with lease and always asks first ("Force-push main to origin/main? Commits on origin/main that main does not contain are lost. git refuses if origin/main moved since the last fetch."). Without an upstream,psays to useP u.Enteron a branch checks it out (git switch); on the current branch it says "Already on; nothing ran". -checks out the previous branch. If uncommitted changes would be overwritten, git refuses and nothing changes.nasks for a new branch's name in a prompt that checks it as you type, withgit check-ref-format --branch's rules ("Not a valid branch name: it contains '..'", "A branch named main already exists");Entercreates the branch at HEAD and checks it out, keeping uncommitted changes. Escape cancels. On a branch with no commits it is refused.- Checkout, the previous branch, pull and abort rewrite the work tree, so like a discard they are refused while a file in the repository has unsaved changes, and open buffers are compared with disk afterwards.
A fetch, pull or push may take a while; the view stays usable meanwhile (moving,
diffs, g r, the log), other actions say "Busy:
Fetch... (or the pull's or push's title) with git's latest progress
line. When it ends, the result is reported even if you have moved on: "Fetch: done",
"Push main to origin/main: done", or "Merges and rebases. m and r work where f does. While a merge or rebase is
in progress (started by Ches or outside it), the head summary shows it and the key
whose popup goes on: "Merging 1a2b3c4 (press m)", "Rebasing main onto 1a2b3c4
(press r)".
mwith no merge in progress opens the merge popup for the branch under the Branches cursor, whichever panel has focus (2to choose one):mrunsgit merge --no-edit <branch>("Merge feature").-n(--no-ff) always creates a merge commit and-f(--ff-only) merges only by fast-forward; at most one is on. Only local branches are listed (pull covers remote ones). With the cursor on a header: "Select the branch to merge in Branches (2) first; nothing ran"; on the current branch: "Cannot merge main into itself; nothing ran". Like a pull it is refused on a branch with no commits, while another operation is in progress, and with conflicted files.- While merging,
mopens theMergingpopup:mcommits the merge with git's prepared message (git commit --no-edit --cleanup=strip, which drops its# Conflicts:comment lines),aasks beforegit merge --abort. - While rebasing,
ropens theRebasingpopup:rcontinues (git rebase --continue, keeping each commit's message),sskips the commit being applied ("Skip the commit being applied? Its changes are left out of the rebased branch."),aasks beforegit rebase --abort; the branch returns to where it was. Without a rebase,rsays "No rebase in progress; nothing ran". Starting a rebase other than by pulling (p -r p) is not offered. - Committing the merge and continuing are refused while a file is still conflicted
("Resolve the conflicted files first (s marks one resolved); nothing ran"). A
merge, pull, continue or skip that stops on (new) conflicts fails with "
failed: Stopped on conflicts: resolve each file (x, or Space x in the editor), mark it resolved with s, then continue". - Every one of these, and every resolution, rewrites the work tree: refused while a file in the repository has unsaved changes ("Continue rebase refused: unsaved changes in a.txt; save or undo them first; nothing ran"), and followed by comparing open buffers with disk.
Logs and history. l in a list panel opens the Log popup (in the diff l
stays a motion). Its actions choose what Commits lists: l HEAD; b the branch
under the Branches cursor, whichever panel has focus; a HEAD and every local and
remote-tracking branch; f a file's history, following renames: in Files the
selected file, in Branches and Commits the file of the diff line at the cursor.
Switches: -g draws the graph (on at first), -m (--no-merges) omits merge
commits, -p (--first-parent) follows only the first parent of merges. The
choice, switches included, holds until the next one, also while the view is hidden,
and the popup opens with its switches; l l returns to HEAD. Choosing focuses
Commits with its cursor on the section title (j reaches the first commit).
Without a branch or file to log: "Select a branch in Branches
first", "Select a file first: a Files item, or a file in the diff".
- The Commits section's title names the log:
Recent commits,Commits on feature,All branches,History of src/a.ml, with any qualifiers after it, as inCommits on main (no merges, first parent, first 200).first <n>means the log filled its limit, so there may be more:+in Commits doubles the limit, keeping the cursor, up to 12800 ("Showing the most commits already (12800)"). - Each row is the graph, the short hash, git's ref decorations, then the subject:
● a1b2c3d (HEAD -> main, origin/main, tag: v1) Subject. The graph is drawn from the commits' parents, one row per commit as in lazygit, over commits in topological order:●is the commit,│a lane waiting for an older commit, a merge reads●─╮(a lane opens for its second parent) and a fork point●─╯(a lane joins). It is cut at 24 columns (…). There is no graph for a file's history or with-m; with-pit follows first parents only. - A commit's diff starts with its file list, between the message and the first
file, one line per file: the change letter (
Aadded,Ddeleted,Mmodified,Rrenamed,Ccopied,Ttype changed,Uunmerged), the path (the new one for a rename),+added -removedover the lines the diff shows (none for binary, mode-only and rename-only files), and(truncated)when the file's diff was cut short:
M src/view.ml +12 -3
R docs/new_name.md +1 -1
A logo.png
Enter on a listed file jumps to its diff (e opens the file). } / { move
between the files' first header lines, with counts (3}); at the ends they say
"No next file" / "No previous file".
- In a file's history a commit's diff is still the whole commit, but the cursor
starts at that file (under the name it had in that commit).
- Space g l in the editor shows the history of the file being edited (see
Browsing history).
e in the diff opens the work-tree file at the line the cursor is on (for a removed
line, the next line that survives; for a hunk header, its first line). From a tab, the
file's tab replaces the view's; beside the split, the file shows in the editor pane,
which gets focus. A commit's diff opens today's file at the commit's line numbers.
The view refreshes when it opens, on g r, and after a save of a file inside the
repository (at most once per save; saves inside .git, such as the commit
message, do not count); it never polls or watches files. Its git
commands run in the background, so the editor never waits for them; while one runs,
the last state stays drawn. Git never prompts on the terminal
(GIT_TERMINAL_PROMPT=0) nor starts an editor (GIT_EDITOR=true, so a continued
rebase keeps each commit's message), and git's lock files are released on quit:
Ches waits up to three seconds after the terminal closes for its git children to
end. Outside a
repository the view says VCS: not a repository; g r looks again. Paths,
subjects and output from git are shown with control bytes escaped.
Resolving conflicts¶
A merge (m m) or a rebase pull (p -r p) that cannot apply every change stops
with the conflicted files in the Files panel's Conflicted section, each with its
kind (both modified, deleted by them, ...), and the head summary saying how to
go on. Then, for each file:
- Take a whole side:
xon the file opensResolve <path>:otakes ours,ttheirs, and, forboth modifiedandboth added,mwrites the conflict markers again, dropping edits made to the file (to start it over; the file stays conflicted). Taking a side checks that version out and stages it, which marks the file resolved; when that side has no file (Take ours: delete the file (HEAD)), the file is removed instead. Each asks first: "Take theirs (1a2b3c4) for a.txt? The other side's changes and any edits to the file are lost; it is marked resolved.", "Resolve a.txt by deleting it, as ours (HEAD) did? Any edits to the file are lost.", "Restore the conflict markers in a.txt? Edits to the file are lost." The popup names the sides:
| Stopped in | Ours (o) |
Theirs (t) |
|---|---|---|
| A merge | HEAD, the branch you are on |
The merged branch, by its abbreviated commit |
| A rebase | the upstream being rebased onto |
your commit being applied |
- Or resolve it hunk by hunk:
Enteron the file focuses its diff, which shows the conflict markers, andEnter(ore) on a line opens the file there. In the editor,]n/[ngo to the next / previous conflict andSpace x u/l/a/bkeep its upper / lower / both / base side (see Conflict markers; upper is ours, lower theirs, with the same swap while rebasing). Edit freely,Space wto save, return to the view and pressson the file to mark it resolved.sdoes not look for leftover markers:Gthen[nfinds any.
When the Conflicted section is empty, m m commits the merge, or r r continues
the rebase. A rebase may stop again on a later commit's conflicts (resolve them the
same way, or r s to leave that commit out); m a / r a abandon the whole
operation. Unsaved buffers in the repository refuse continuing, committing, taking
a side and aborting: save the resolutions first (or undo them).
Browsing history¶
Commits lists HEAD's latest 200 commits, with the graph and each commit's branches
and tags. 3 focuses it; j / k move, and the diff follows, starting with the
commit's file list. Enter (or Tab) focuses the diff: } jumps to the next file,
or move to a listed file and press Enter; e opens the file at the cursor's line.
Tab returns to Commits.
l changes the log. With a branch selected in Branches (2), l b lists it;
l a lists every branch together, the graph showing where they fork and merge;
l - m l reads HEAD without merges (and without the graph). The popup opens with
the switches last chosen, so l - m l again brings merges back.
When the title ends in first 200, + reads 400, then 800.
For one file's history, press Space g l (palette VCS: history of this file) in
its buffer: the view opens where it opens, or is shown, focused on Commits listing
the commits that changed the file, across renames. Each commit's diff starts at
that file. In the view, l f does the same for the selected Files item or the file
of the diff line at the cursor. From a directory buffer or a view, Space g l says
"No file buffer here: Space g l shows the history of the file you are in"; for a
file outside the view's repository, "
Read-only text in supporting views¶
Open details (problems, the demo report, and history) are read-only text, like a read-only buffer in a Neovim split, with the terminal cursor on the text cursor:
| Details keys | Action |
|---|---|
h/l, 0 ^ $, w/b |
Move within the text (0/$ and ^ use the whole logical line, not the wrapped row) |
j/k, gg/G, Ctrl-d/u |
Move by wrapped row, to the first/last row, or by half the view |
Count, e.g. 10j |
Repeat h j k l w b Ctrl-d Ctrl-u (10j, 3w, 2 Ctrl-d), stopping at the ends; 12G or 12gg goes to line 12 |
v / V |
Characterwise / linewise Visual selection; again to end it, o swaps ends |
y (Visual), yy / Y |
Copy the selection, or the cursor's whole line |
e |
Close details (Enter also jumps in problems, a acknowledges) |
Escape |
End a selection, then close details, then return |
A copy goes where an editor yank goes: the unnamed register, so p in the editor
pastes it, and the system clipboard. It copies the text itself, never the wrapping,
padding, border, or markers, and shows Copied … in the view's footer. Copying and
selecting never acknowledge, resolve, or jump. Edit keys (i, x, d, p, u,
…) and pastes are rejected with a notice. If a problem's text changes while its
details are open, the view takes the new text and ends any selection, saying so.
Words and lines¶
w, b, and e treat a run of identifier characters (ASCII letters, digits,
_, and every non-ASCII character) as a word, and a run of other non-blank
characters (punctuation, such as += or () as another. W, B, and E treat
any run of non-blank characters as one word. Blanks are space, TAB, and line
breaks. As in Vim, w and b stop on empty lines and e skips them.
wgoes to the start of the next word; after the last word it goes to the end of the text.bgoes to the start of the current or previous word.egoes to the end of the current or next word, and stays put when there is none.^goes to the first character that is not a space or TAB (the last character of an all-blank line)._does the same, but takes a count like$:3_is the first non-blank two lines down. (Later, under operators,_is linewise.)g_goes to the last character that is not a space or TAB (the start of an all-blank line), with the same count rule. Without trailing blanks it lands where$does.Ggoes to the last line, andggto the first, at its first non-blank. With a count, both go to that line:20Gand20ggare line 20, and999Gstops at the last line. A file ending in a line break has an empty last line after it, soG(andwafter the last word) goes there.
Matching delimiters¶
% finds the first (, ), [, ], {, or } at or after the cursor on its
line and jumps to its mate: forward from an opening delimiter, backward from a
closing one, across lines, skipping properly nested pairs of all three kinds.
- Matching is lexical: delimiters in strings and comments count too.
- Mixed kinds nest on one stack, so in
( ] )the(has no match. A misnested or missing mate showsNo match for (and the cursor stays. - With no delimiter from the cursor to the line end, it shows
No delimiter on this lineand the cursor stays. - It takes no count:
50%(Vim's jump to a percentage of the file) is rejected.
Conflict markers¶
When git cannot merge a file it writes both versions into it between marker lines. The editor finds these regions in any buffer, whatever wrote them, and resolves one at a time, as Emacs's smerge does:
<<<<<<< HEAD the upper side follows
ours
||||||| merged ancestors the base part (only with merge.conflictStyle=diff3 or zdiff3)
base
======= the lower side follows
theirs
>>>>>>> feature the end of the region
(Indented here so that this file is not itself conflicted: real markers start their lines.)
| Keys | Action |
|---|---|
]n / [n |
Go to the start line (<<<<<<<) of the next / previous region; 3]n goes three on |
Space x u |
Keep the upper side |
Space x l |
Keep the lower side |
Space x a |
Keep both: the upper side, then the lower |
Space x b |
Keep the base part |
The palette lists them as Conflict: keep upper (ours), Conflict: keep lower
(theirs), Conflict: keep both, Conflict: keep base, Conflict: next and
Conflict: previous (conflict.keep-upper, ..., conflict.next,
conflict.previous).
What the sides are depends on what stopped:
| Stopped in | Upper (<<<<<<<) |
Lower (>>>>>>>) |
|---|---|---|
A merge (m m in the VCS view, git merge) |
Ours: HEAD, the branch you are on |
Theirs: the branch being merged |
A rebase (p -r p in the VCS view, git pull --rebase) |
The upstream you are rebasing onto | Your commit being replayed |
The labels after the markers say which is which (HEAD, a branch name, or a
commit and its subject while rebasing; markers written again by the VCS view's
x then m say ours and theirs), and the feedback repeats them.
Space xacts on the region containing the cursor's line, markers included: the whole region is replaced by the side's lines, and the cursor goes to the first of them (or, when that side is empty, to the line now where the region was). The feedback says what was kept, e.g.Kept upper (HEAD)orKept both (HEAD, feature).- It is one undo step:
ubrings the markers back. The buffer is marked modified and nothing is saved untilSpace w; marking the file resolved in git is a separate step (sin the VCS view, see Resolving conflicts). - Outside a region it shows
No conflict at the cursor;Space x bon a region without a base part showsThis conflict has no base part (merge.conflictStyle=diff3 shows one). Neither changes anything. ]nand[ncount only complete regions. From inside a region,[ngoes to its start line. A count beyond the last region stops at the last; with none in that direction they showNo more conflictsand the cursor stays. They extend a Visual selection, and afterdorythey are linewise (d]ndeletes through the next start line).Space xworks in Normal mode only, and, like other edits, not from a supporting view's read-only text.- A region is recognised only in git's default form: start, base and end lines
begin with exactly seven
<,|or>followed by a space or the line end, and the separator is exactly seven=. Other marker sizes (conflict-marker-size), indented markers, and regions that are unterminated or out of order (an end before the separator, a second base or separator) are left alone as ordinary text; a new start line before the end starts over. Markers are not highlighted.
Counts¶
In Normal mode, digits before a movement key repeat it: 20j moves down 20
lines, 5l moves right 5 characters, and 3w moves 3 words. A count stops at the
edge rather than failing: 999j near the end goes to the last line, and 20l on a
short line goes to its last character. The status line shows a count while you
type it, with any keys of the sequence after it (20 g, 3 Space v).
1–9start a count, and any digit, including0, extends it. A bare0is the line-start motion:10jmoves 10 lines, and0then goes to the line start.- Counts go up to 999999. Typing a larger one cancels it with a message.
$,_, andg_with a count N go to the Nth line, counting the current line as the first.Gandggwith a count go to that line.0,^,%, andzz/zt/zbtake no count.x,X,p, andPtake a count; operator and motion counts multiply (2d3wdeletes and2y3wyanks six words). A count repeats a resize step as that many presses would:3 Space v +widens the text by 30 cells, andSpace v h/l/H/L,Space s +/-,Space v p +/-, andSpace d +/-work the same way, stopping at their usual limits. A count before an unsupported command, such as3^,2 Space w, or2 Space v c, is rejected with a message.Escapecancels a pending count silently. A key that is not bound after a count,Ctrl-c, or a paste also cancels it. Nothing typed before a cancellation carries over to the next key.
Delete, yank, and paste¶
d waits for a supported motion: dw, db, de, d$, dj, dgg, dG,
d_, dg_, d%, and diw are available. dd deletes the current line, D is
d$, and x/X delete forward/backward without crossing a line break. A
successful delete replaces the unnamed internal register (characterwise,
linewise, or blockwise). Escape cancels a pending d sequence without changing text or that
register. Every complete delete, including a counted one, is one undo step.
y accepts the same supported motions (apart from the deliberately narrow diw
text object); yy yanks logical lines. Yanking changes neither text, cursor,
history, nor dirty state. p inserts characterwise text after the cursor and P
before it; linewise text goes below/above the current line. A paste count repeats
the register in one undo step. Characterwise paste leaves the cursor on its last
inserted code point; linewise paste puts it at the first non-blank of its first
inserted line. An unset register reports feedback. Undo and redo do not restore
the register.
Whenever a delete or yank replaces the register, ches also copies its text to the
system clipboard, like Vim's clipboard=unnamedplus. Linewise text ends with a
newline, and a block's rows are joined by newlines. The copy is an OSC 52 escape
sequence sent to the terminal, so it reaches the clipboard of the machine running
the terminal, including over SSH. The terminal must allow it: Ghostty, kitty and
WezTerm do by default; under tmux, set set-clipboard on. p
still pastes the internal register; paste from the system clipboard with the
terminal's own paste.
dw stops at a line end rather than consuming its newline and the next line's
indentation. d% includes both matching delimiters; an unmatched % does
nothing. Linewise deletes at EOF preserve the editor's invariant that an empty
document has one logical empty line.
Visual selection¶
v anchors a characterwise selection at the cursor and V anchors a linewise
selection. Ordinary motions (including counted motions and %) move the active
end; reversing direction is supported. v and V switch its kind without
losing the anchor. Selection highlighting takes precedence over search and
current-line highlighting while the terminal cursor remains visible. d, c,
and y use the same typed unnamed register and range behavior as their Normal
mode counterparts. Delete and change are each one undo step; yank returns to
Normal mode at the selected range's start without changing history. Visual paste,
text objects, and search prompts in Visual mode are not supported.
As in Vim, l, j, k, and $ in Visual mode can put the cursor on the line
break after the last character, so v$ selects through the end of the line
including its newline (v$d on abc / def leaves def). Leaving Visual mode
steps back off the line break.
Ctrl-v selects a rectangle of screen columns, as in Vim. Each corner covers the
whole character it is on, so a corner on a TAB or wide character covers all of
its cells; reversed and upward selections give the same rectangle. After $ the
block reaches each line's own end until another horizontal move. TAB cells are
highlighted only where they fall inside the block, a wide character cut by an
edge is highlighted whole, and lines shorter than the block show no highlight.
Selecting changes nothing.
d and y on a block put it in the register as one row per line, as Vim does:
a line too short to reach the block contributes a row of spaces (one that ends at
the block's first column, nothing), a line ending inside it only its text, and a
TAB or wide character cut by an edge spaces for its cells inside the block. d
removes the selected cells, leaving spaces for the outside cells of a cut TAB or
wide character, in one undo step; both leave the cursor at the block's top-left.
p/P with a block register put each row after/before the cursor's column on
successive lines: short lines are padded up to the column, a TAB under it is split
into spaces, a wide character under it moves right, and rows past the last line
add lines (keeping a final newline final). Rows are padded to the block's width
when text follows them, so it stays lined up; a count repeats each row along its
line. A paste is one undo step with the cursor at its top-left. Unlike Vim,
padding measures a TAB inside a row where it lands rather than as a full tab
stop.
I and A on a block start a block insert: Insert mode with an insertion point
on every line of the block, before its left edge for I and after its right edge
for A (after $, at each line's own end). c deletes the block and inserts at
its left edge. Unlike Vim, which copies the text to the other lines when you leave
Insert mode, typing appears on every line as you type. Every insertion point is
drawn as a colored cell: the cursor itself, on the top line, in blue, and its copies
on the other lines in light grey (the terminal's own cursor is hidden meanwhile;
change the palette's Block_cursor and Block_copy roles in theme/theme.ml).
As in Vim, I and c skip lines too short to reach the left edge, A pads short
lines with spaces, a TAB under the insertion column is split into spaces, and a
wide character there moves right. Backspace (and soft-tab Backspace) removes only
what was typed in this insert. Enter, a paste containing a newline, and Delete are
refused with a message, because they would make the lines differ. A count (2I)
repeats the typed text when you leave. The whole insert, including c's
deletion, is one undo step, and none if nothing was typed. After I or A the
cursor goes to the block's top-left, as in Vim. I and A on a characterwise
or linewise selection are not supported (they report so).
f{character}/F{character} find a literal code point strictly forward or
backward on the current line; t/T stop just before/after it. Counts repeat
the find, ; repeats the last successful find, and , repeats it in the
opposite direction without changing what ; means. They work as operator
motions too (df) and dt,); Escape cancels while waiting for the literal
argument, and a failed find retains the previous successful one.
Search results are highlighted while a query is active; the current result uses
a distinct highlight. Searches use smart ASCII case by default: a query with an
upper-case ASCII letter is case-sensitive, while an all-lowercase query matches
ASCII letter case-insensitively. The core's Editor.create also accepts a
search_case preference (Smart, Sensitive, or Insensitive) for alternate
frontends. * and # search the small word under the cursor as a
whole word (so cat does not match scatter); on whitespace they report that
there is no word. The query and highlighting are derived from the current text,
so edits cannot retain stale match positions. In Normal mode, Escape clears
the highlighting while retaining the query for n/N. While typing / or
?, its nonempty query highlights matches immediately but does not move the
cursor; cursor-following incremental search is deferred as a future setting.
Reloading a file¶
In Normal mode, type :e! then Enter to discard all unsaved buffer changes
and replace the buffer with the current contents of its associated file. It
also clears undo/redo history. Escape cancels the small command prompt. This is
deliberately the only : command currently supported; an unknown command
reports feedback without changing the buffer.
Soft tabs work like Vim's softtabstop: Tab inserts spaces up to the next
multiple of 2 screen columns (a TAB before the cursor counts for its width), and in Insert mode Backspace deletes spaces back to the
previous multiple, or one character if there is no space before the cursor.
Backspace at the start of a line joins it to the line above, and Delete at
the end of a line joins the line below. x never deletes a line break.
j is inserted when you type it; a k straight after it deletes the j and
returns to Normal mode. No timeout is involved, and typed text is never held back,
but you cannot type jk itself (paste it instead). Tab width, the j k escape,
and the Normal-mode bindings are settings in Keymap.Config, chosen in code; there
is no configuration file. The bindings are a table (input/bindings.ml) checked when
it is built: a key sequence bound twice, a sequence that is a prefix of another
(which could never run, since there is no timeout), a sequence starting with
1–9 (which starts a count), or one using Escape or Ctrl-c is an error.
Entering Insert mode and autoindent¶
a on an empty line inserts at the cursor, and I on an all-blank line inserts
at its end. o and O work on the last line with or without a final line break
and in an empty file. Opening a line and the typing that follows are one undo
step, which restores the cursor to where it was before o/O. These commands
take no count (3o is rejected with a message); Vim's repeated insertion is not
supported.
Autoindent is literal and knows nothing about the language: o and O copy the
current line's leading spaces and TABs, and Enter copies the part of them that
is before the cursor (so Enter inside the indentation copies only what is to its
left). Text after the cursor moves to the new line unchanged, leading blanks
included. Unlike Vim, the copied indentation stays when you leave Insert mode
without typing anything. A paste is inserted literally, without indentation.
Shifting indentation¶
>> and << shift the current line right or left by one indentation step. A
Normal-mode count chooses how many lines to shift, clamped at the end of the
buffer: 3>> shifts three lines once. In every Visual selection kind, > and <
shift the full touched lines and return to Normal mode; here a count chooses the
number of steps, so 3> shifts the selection by six columns with the defaults.
A characterwise selection whose later endpoint is exactly at the next line's
start excludes that final line. Linewise and blockwise selections include both
endpoint lines. Shifting a block affects whole lines, not just its rectangle.
The default step is two display columns, added or subtracted without rounding to a multiple; left shifts clamp at zero. TABs in existing indentation use eight-column display stops. Rewritten indentation uses spaces by default, preserving all text after the leading whitespace and the file's final-newline state. Normal/Visual right shifts skip empty and whitespace-only lines; left shifts can remove their indentation. Each Normal/Visual operation is one undo step, leaves the unnamed register alone, and places the cursor at the first shifted line's first nonblank. A shift that changes no bytes creates no undo entry or text revision.
Insert Ctrl-t / Ctrl-d shift the current line while keeping Insert mode and
tracking the insertion point relative to its text. They can build indentation on
an empty line and join the current Insert undo transaction. During a block insert,
they finish multi-line replication and shift only the current line; prior replicated
typing stays in the same transaction. A cursor inside rewritten indentation tracks
its display column, clamped to the new prefix; a column inside a TAB lands before it.
The core accepts Editor.create ~indentation with an Indentation.Policy.t
(shift_width, positive, and use_tabs). A tabs policy emits whole TABs followed
by remainder spaces. This policy is separate from Keymap.Config.tab, which
controls Insert Tab/Backspace soft tabs. Defaults are chosen in code; there is no
runtime settings prompt. Motion-based shifts such as >j, counts between the
two keys such as 2>3>, = reindent, and language-aware indentation are not yet
implemented.
Space starts a sequence only in Normal mode. While a sequence is pending, the
status line shows its keys. An unbound continuation such as Space z does
nothing except report Space z is not bound. Sequences have no timeout.
Pasting (with a terminal that supports bracketed paste) inserts the text literally in Insert mode and is ignored in Normal mode. Arrow keys and the mouse are not used. SIGTERM or SIGHUP ends the editor, discarding unsaved changes, after restoring the terminal.
Syntax highlighting¶
Ches highlights OCaml implementation (.ml) and interface (.mli) files, plus
SystemVerilog (.sv, .svh), Verilog (.v, .vh), and AT&T/GAS assembly
(.s, .S), locally with Tree-sitter. .asm is unsupported, not Intel syntax.
Verilog uses the SystemVerilog grammar. Suffix detection is case-sensitive: .ML,
.SV, extensionless files, unsupported languages, and buffers without a path stay
plain text. No language server, network access, external query files, or Neovim
installation is needed at runtime. Syntax highlighting does not change editing, %, saved bytes,
registers, dirty state, or undo/redo.
Keywords, strings/escapes, numbers, nested comments and structural type/function/
module/constructor constructs receive colors. This is grammatical highlighting,
not semantic name resolution; it does not know a symbol's meaning across files.
Incomplete and malformed code is normal input and can still receive useful colors.
Assembly directives, mnemonics and prefixes are keywords; registers are constants;
labels and numeric local references are functions; symbols are variables; relocation
modifiers and directive types such as @function are properties. Numbers, strings
and comments retain their usual categories. The grammar supports numeric local
labels, immediate/displacement arithmetic and simple assignments, but is not an
assembler validator. x87 %st(0), AVX-512 decorators, relocation modifiers in
directive arguments, multiple same-line labels and rep; ret are not fully supported.
.S preprocessor lines are treated as comments, not C-preprocessor syntax.
If provider initialization or parsing fails, the current document renders as plain
text rather than keeping stale colors. This does not block editing or saving or
replace editor feedback; a later text change or successful reload retries it.
The controller caches highlights by document identity, revision, language and query
version. Text changes use incremental parsing with a private copied/edited prior
tree; :e! resets it. Movement, search, selection, scrolling, resizing, animation
and saving unchanged text do not parse. Synchronous highlighting is limited to
65,536 bytes, 2,000 lines and 16,000 query captures (inclusive). Lines include
the empty final line after a trailing LF. Byte/line checks happen before provider
creation or parsing; capture collection stops at the first excess result, including
duplicate/ignored captures. Outside this policy the entire current revision renders
plain, with no stale or partial syntax spans and no repeated warning notifications.
Controller.highlight_status records Source_byte_limit, Source_line_limit or
Capture_limit with the limit. Search/selection and other overlays still work.
Byte/line fallback recovers automatically when the text fits both limits. Capture
fallback remains plain across small edits and retries after at least a 25% byte
or line-count shrink relative to the failing revision, a successful :e! reload,
or language-association reset. A same-size syntax simplification may therefore stay
plain until reload. The limits are fixed implementation policy, not user settings.
Within policy, the full tree is still queried and ranges normalized on each edit.
A local 205 KB generated fixture fell from 83.079 to 0.643 ms/edit with plain
fallback; a highlighted 50,707-byte core/editor.ml fell from 15.544 to 8.761 ms/edit
after capture/normalization improvements. These are measurements, not guarantees.
There is no parser/query timeout in the binding: a dense source's first parse and
up to 16,001 capture calls can still delay input before fallback is latched. Whole-string
editing remains size-dependent. Native memory release relies on binding GC finalizers,
with limited external-memory accounting. See the latency handoff.
Syntax colors come from the active semantic palette in theme/theme.ml, mapped
to terminal attributes by ui/theme.ml. Variables/operators/punctuation use ordinary text
color. Special-display escapes/clip markers take precedence over syntax; interaction
overlays on complete glyphs take precedence over both. Clipped wide/escape fragments
keep their special treatment, and combining marks retain their base text style.
Block-insert points override selection, which
overrides search; syntax returns when the overlay clears. Current-line background
is independent, and blank padding is not syntax-colored. Theme changes recolor the
existing semantic spans without reparsing the document or adding font styles.
The pinned tree-sitter.0.1.0 opam package supplies the compiled-in runtime and
the OCaml grammars (tree-sitter and tree-sitter.ocaml Dune libraries). The
SystemVerilog grammar is pinned and bundled in highlight_tree_sitter/grammar; its
generated C parser is stored compressed and expanded by gzip during the build.
The locally patched GAS grammar is bundled similarly in
highlight_tree_sitter/gas_grammar; its upstream license is GPLv3, not the license
of Ches-authored code. See its asset record
for notices, regeneration and distribution implications.
The GAS grammar handles compiler debug .file/.loc whitespace-separated arguments
and their following instructions; other directive argument lists remain comma-separated.
Building needs a C compiler and gzip, not Node, a Tree-sitter CLI or grammar
regeneration. Queries are Ches-owned, predicate-free strings in
highlight_tree_sitter/ocaml_queries.ml, systemverilog_queries.ml and gas_queries.ml. Packaging,
ownership and unresolved bundled-asset provenance/license-notice findings are
recorded in highlight_tree_sitter/ASSETS.md; technical
verification is not a license-compliance finding.
Regression tests run with dune runtest; explicit performance probes are separate:
opam exec --switch=5.2.0+ox -- dune exec -j 10 ./scripts/syntax_incremental_probe/probe.exe
opam exec --switch=5.2.0+ox -- dune exec -j 10 ./scripts/syntax_live_probe/probe.exe
The terminal checklist below covers visual review. See
docs/archive/syntax_highlighting_plan.md for measurements,
check outcomes and the acceptance handoff.
Text¶
Ches edits UTF-8 text with LF line endings. Opening a file fails with a clear
error, instead of silently converting it, if the file has invalid UTF-8, a CR
byte (CRLF or bare CR line endings), or a NUL byte. Typed and pasted text follows
the same rules: text that breaks them is rejected with a Rejected text: ...
message. Saving writes the text back exactly as it is, including whether it
ends with a newline.
Cursor movement and deletion work on Unicode code points, and the status-line
column counts code points; j/k and soft tabs use screen columns. On screen, characters take their terminal width (CJK
characters take two cells), a TAB expands to the next multiple of 8 cells, and
control characters are drawn as escape forms (see Screen).
Undo¶
u and Ctrl-r work in Normal mode, and they restore both the text and the
cursor.
- Everything typed in one visit to Insert mode, including Backspace, Delete, Enter, and pastes, is one undo step. Leaving Insert mode ends the step.
- Each Normal-mode edit (
x) is its own step. - Moving and switching modes add no steps.
- A new edit after an undo discards the redo history.
[+]means the text differs from what was last saved. Undoing back to the saved text clears it, so a plainSpace qthen works.
History is kept for the session only, as whole-text snapshots (see Storage). Each buffer defaults to at most 1,000 complete transactions and 64 MiB of estimated retained bytes, across undo and redo together. Older steps are evicted only when a changed transaction closes. The newest complete step always survives even if it exceeds the soft byte budget, so large files still have at least one undo step. A no-net-change transaction preserves redo and retention.
Screen¶
The text sits in a tile centered on the screen, 100 cells wide when there is
room, with the filename in its top border. The status line at the bottom shows
the mode, filename, [+] when there are unsaved changes, pending keys, the line
and column (one-based; the column counts code points), and the latest message.
Between the left border and the gutter (or the text, with no gutter) are 2 blank
cells of padding, outside the text width. On a small screen the border goes
first, then the padding and gutter together; status fields are dropped from the
least important up.
Line numbers are off by default. Space v n and Space v N toggle Vim's
number and relativenumber switches independently, giving four styles: off
(neither, with no gutter), absolute (n only), relative (N only; the cursor
line shows 0), and hybrid (both: the cursor line shows its own number,
left-aligned, and every other line its distance from the cursor). The gutter is max(3, digits in the line count) cells plus a separator
in every numbered style, so switching between them or moving the cursor never
shifts the text. With numbers off, a centered tile with room keeps its text width
and narrows, so the text moves left by about half a gutter; at full width, or when
the screen limits the width, the text gets the gutter's cells instead. Numbers
off also lets the border fit on a slightly narrower screen.
The view scrolls only as far as it must to keep the cursor visible: there is no scroll margin, and long lines scroll sideways rather than wrap. When the terminal is resized, the tile, gutter, and scroll are fitted to the new size at once, without waiting for a key. Any size works, down to 1×1; when no text cell fits, the cursor is hidden until there is room again.
The cursor is a steady block in Normal mode and a steady bar in Insert mode, where the terminal supports cursor shapes. Quitting restores the terminal's own cursor.
Scrolling the view¶
Ctrl-e and Ctrl-y scroll the view down and up by a line, or by N with a
count, as in Vim. The cursor stays on its line while that line is visible;
when it would scroll out of view, the cursor moves to the nearest visible line,
keeping its column as j and k do. Ctrl-d and Ctrl-u move both the view
and the cursor by half the text rows (at least 1), or by N lines with a count
(for that use only; Vim's scroll setting is not supported). zz, zt, and
zb put the cursor line at the middle, top, or bottom of the view without moving
the cursor; they take no count.
- At the end,
Ctrl-ecan scroll until the last line is at the top, andztcan put the last line there. Moving the cursor within the view then leaves it as it is.Ctrl-dstops scrolling once the last line is at the bottom but keeps moving the cursor, so repeating it reaches the last line. - At the start, scrolling stops at line 1, and
Ctrl-uthen moves only the cursor. Nothing happens at either end once there is nowhere to go, and there is no message. - A resize fills a view scrolled past the end, so it is not partly empty while earlier lines are hidden; so does the first key typed after a resize. Ordinary movement does not.
- These keys are Normal-mode only; in Insert mode they do nothing. They never edit: no undo step, no dirty marker.
Layout controls¶
The default layout is a centered tile with a text width of 100 cells, an
offset of 0, and no line numbers. The text width counts only text cells, not
the padding, gutter, or border. The left padding has no key; it is
left_padding in Geometry.Prefs.default (screen/geometry.ml).
Space v r returns to this default.
The Space v commands change the layout, never the document: they make no
edits, move no cursor, and leave undo history and the dirty state alone. Moving
the tile or changing its width also switches back from full width to centered.
The requested text width is kept within 20–500 cells and the offset within
±500. When the screen is too small for a request, the tile is clamped to fit, and
the request is kept, so the layout comes back when the screen grows. The status
line shows the request and, when it differs, what fits: Width 110 (74 fit),
Offset +40 (+12 fit). Toggling and resetting report Centered, Full width,
or Layout reset; the line-number toggles report the new style, noting when the
screen is too small for a gutter: Line numbers: relative (no room). They take
no count. Layout preferences last for the session only: every run
starts with the default layout.
Colors and safe display¶
Ches includes 52 themes: 34 dark and 18 light. Vim Classic is the default; Midnight, Crimson, Ember, and Glacier retain their original colors. Other palettes are curated designs or adaptations rather than exact ports of upstream themes. Examples include Abyss, Moss, Orchid, Cobalt Room, Paper, Porcelain, Terminal Amber, Terminal Green, and neutral monochrome Graphite, Newsprint, Silver Night, and Ivory Ink.
The metallic family includes Copper and eight additional palettes:
| Theme ID | Kind | Character |
|---|---|---|
silver |
Dark | Cool slate with luminous silver-blue accents |
silver-frost |
Light | Icy silver with crisp, deeper syntax colors |
silver-tarnish |
Dark | Aged silver with a subtle green cast |
gold |
Dark | Rich gold on a warm, dark ground |
gold-antique |
Dark | Muted bronze and olive-gold |
gold-champagne |
Light | Warm champagne with ochre accents |
platinum |
Light | Refined cool neutrals with a faint lavender cast |
iron |
Dark | Industrial charcoal with rust and steel-blue accents |
For nostalgic Vim colors, Vim Classic (vim-classic) uses a pure-black
document, backdrop, and current line with yellow keywords, pink strings/numbers,
electric-blue comments, green types, and cyan functions. It is a Vim-inspired
approximation rather than an exact reproduction of a particular Vim version.
Solarized Light (solarized-light) adapts Solarized's cream ground and
slate text, green keywords, cyan strings, blue functions, and magenta literals.
Linen Solar (linen-solar) has lighter warm paper with stronger teal/blue/green
syntax; Sandstone Solar (sandstone-solar) has golden paper and deeper ink
and accents. The original Linen and Sandstone palettes remain available unchanged.
Space v T or Choose theme in the command palette opens a framed floating
chooser in workspace, zen, or bare. It starts on the current theme; * marks the
original selection. Type a fuzzy title query to filter; Tab/Shift-Tab or Ctrl-n/p
select the next/previous result. Filtering and selection preview the entire
interface immediately, including the chooser, document, gutters, and other views.
Enter applies the selected theme and closes; Escape restores the theme active
before opening. With no matches, the last preview stays visible and Enter applies
nothing. Closing due to an undersized terminal, focus loss, or replacement by
another float also cancels the preview. Paste belongs to the query, not the file.
Use ches --theme glacier PATH (or ches --bare --theme paper PATH) to select at
startup. ches --list-themes prints stable IDs, titles, and dark/light kinds
without a terminal or PATH. IDs are case-insensitive; surrounding whitespace is
ignored and spaces/underscores normalize to hyphens. Unknown themes report an
error pointing to the list. The active theme is shared by all presentations and
lasts for this session; there is no automatic on-disk preference persistence.
The pure Ches_theme.Theme library owns immutable RGB palettes. Screen state
owns the effective choice, while Theme.attrs ~theme in ui/theme.ml maps
semantic styles to terminal attributes. Selection, search, and diff colors have
dedicated roles. Render caches include the effective theme so accepting,
previewing, and cancelling redraw correctly without editing or reparsing text.
Theme.of_base16 adapts 16 RGB palette slots into a complete role palette; built-in
additions are data in theme/theme.ml. External theme-file discovery/loading is
not implemented. The renderer requests truecolor; actual display depends on the
terminal's color capabilities.
Font styles (bold, italic, underline) are set per part of the screen by
Theme.Font.default and can be replaced in code with Editor_view.run ~font;
the terminal still chooses the typeface, and a terminal without italics may
ignore them.
Document styles are composable records under Ches_screen.Style.Document:
syntax category (or plain), current-line background, special-display treatment, and
interaction overlay. The ~font callback still takes Style.t; custom callbacks
that previously matched flat document variants must now inspect the record, e.g.
Document { special = true; _ } instead of Special | Special_cursor_line.
Chrome variants such as Title and Status are unchanged.
Everything is also readable without color: the mode, [+], and messages are
text, and escape forms are bracketed.
Text is shown safely: a TAB expands to the next multiple of 8 cells, and
control characters, C1 controls, and bidi controls appear as visible escape
forms (^[, <85>, <202e>) instead of reaching the terminal.
Architecture¶
One key press goes through these steps:
ui/(Bonsai_term) receives a terminal event.Terminal_inputturns it into a terminal-independentKey.t, or into the start or end of a paste.screen/Ui_statecollects any paste and passes the input to the session's focused file/directory controller, retaining buffer/context paste ownership.app/Controllerfeeds it toinput/Keymap. The keymap tracks pending counts,Spacesequences, and thej kescape, looks Normal-mode sequences up in itsinput/Bindingstable, and returns actions. An action is either an editor command, such as a counted move, or a view command.- Editor commands go to
core/Editor.dispatch, a pure function from state and command to a new state plus a list of effects, such as "write this exact text to this path" or "exit". The controller runs the effects synchronously and reports each outcome back to the editor. A save marks the text it wrote as saved, not whatever is current when it finishes. After the final text revision change,app/Highlightingupdates the immutable highlight snapshot using its privately owned provider; no parsing happens in frame drawing or Bonsai rendering. app/Sessioncoordinates buffer lifetime, navigation, shared registers, guarded quit and filesystem apply. Directory Save uses its validated planner and executor, never a listing-text write. Layout view commands come back toUi_state; buffer/directory commands are session-owned.screen/Framedraws the editor, keymap, and UI state as rows of styled spans plus a cursor, as plain data.ui/turns the spans into Bonsai_term views withui/theme.ml's colors.
Only ui/ uses Bonsai, so everything from Ui_state down to the finished frame
is tested headlessly with key sequences. ui/ contains only event conversion,
colors, and the Bonsai_term app.
dune-project project and package metadata (generates ches.opam)
error/ ches_error: pure shared notification, active-problem lifecycle, and bounded history
core/ ches_core: pure editing library; depends only on `core`
input/ ches_input: terminal-independent keys and modal keymap
tile/ shared tile host, focus, and input routing
source/ asynchronous diagnostic sources and language-server client
palette/ command catalog and fuzzy matching
theme/ ches_theme: pure semantic RGB palettes, registry, and Base16 adapter
app/ ches_app: file loading/saving, input controller and highlight cache
highlight/ ches_highlight: provider-independent byte ranges, categories,
snapshot keys, normalization/lookup and incremental edit descriptions
highlight_tree_sitter/ ches_highlight_tree_sitter: privately owned Tree-sitter provider and queries
screen/ ches_screen: Bonsai-free screen model: cell mapping, geometry,
scrolling, UI state and transition, status fields and their
layouts, rendered frames
ui/ ches_ui: Bonsai_term frontend (event adapter, theme, app)
test/ core, input, and app tests (expect tests, Quickcheck, temp-dir file tests)
highlight/test/, highlight_tree_sitter/test/ range/edit and fresh/incremental provider tests
screen/test/ headless screen-model tests, including live syntax/overlay geometry
ui/test/ event adapter tests and Bonsai_term_test tests of the app
scripts/ smoke.sh plus explicitly invoked syntax feasibility/performance probes
bin/ches.ml command-line entry point
ches_core, ches_input, and ches_app must never depend on Bonsai,
Bonsai_term, Async, Notty, or any other terminal library. You can build them on
their own with
dune build ./core/ches_core.cmxa ./input/ches_input.cmxa ./app/ches_app.cmxa.
Editor file loading and saving live in ches_app; ches_source owns diagnostic
processes and language-server sessions. ches_screen must not depend on Bonsai
or Bonsai_term; it uses Notty only for its code-point width table, so that its
cell counts agree with what Notty draws. The cell layout itself lives in
ches_core (Cell_layout) with the width function passed in: the frontend
creates the editor with the same Cell_map.width it draws with, so screen
columns in editing semantics and on screen cannot disagree.
Terminal smoke test¶
scripts/smoke.sh drives the built binary in a private per-run tmux server
(tmux -S "$work/tmux.sock"), on copies of fixtures in a temporary directory, and
checks the screen text, cursor position and visibility, the alternate screen,
saved file bytes, exit statuses, and that stty settings and the cursor are
restored after every exit. It exercises the file-editing and layout bindings in the Keys
table, including the Insert-mode editing keys, soft tabs, j k, and an unbound
Space key. It also covers:
- saving, reopening, and undo/redo, including undoing a whole Insert session
- a plain quit refused while there are unsaved changes, and a forced quit
- a save error
- empty and new files
- scrolling tall and wide files, and resizing down to 1x1
- counted movement: the pending count on the status line, clamping at the ends
of the document and of lines, the column kept across short lines, and counts
cancelled by overflow,
Escape, an unbound key, or a command that takes none - word, line, and document motions (
w b e W B E 0 ^ $ _ g_ gg G) with counts, including a pending and cancelledg, andGwith and without a count %across 150 lines and back, from before a delimiter, on a line without one, and with a rejected count- Insert entry (
a A I o O): indentation copied byo,O, andEnterand kept when nothing more is typed, undoing an opened line, and3orejected - tabs, wide characters, and control characters
- a fast burst of keys with a paste in it, and a paste in Normal mode
- every
Space vcommand, with clamping and restoring on resize - workspace status on all four sides, separate width/height requests, scrolling and cursor alignment, hide/show, zen and saved-layout changes, compact fallback and restoration, edit/undo/redo/save, and error visibility across layout transitions
- floating command palette placement and cursor ownership, typed queries and pasted text, acceptance/cancellation and exact colored workspace restoration, no-match Enter, coexistence with all installed tiles, zen, clamped/minimum-size resizing, selected-command retention, too-small refusal/closure, and interrupted paste dropping after a resize and growth
- line-number styles: both toggles from the default (none), a rejected count,
Space v r, renumbering as the cursor moves, and a toggle while too small - view scrolling:
Ctrl-e/Ctrl-ywith counts and a pushed cursor,Ctrl-d/Ctrl-u,zt/zb/zzand a rejected count, scrolling past the end, resizing after scrolling, tiny terminals, and Insert mode - exits by SIGTERM and SIGHUP, a file that cannot be opened, and standard input that is not a terminal
It needs tmux (tested with 3.4), bash, and a UTF-8 locale. It is not run by
dune runtest. It waits for screen/cursor updates rather than assuming a fixed runtime:
dune build && scripts/smoke.sh # tests _build/default/bin/ches.exe
scripts/smoke.sh path/to/ches # or another binary
scripts/smoke.sh --bare-only # bare startup/toggle, --superzen alias, indentation, palette, terminal restoration
scripts/smoke.sh --palette-only # only floating-palette scenarios
scripts/smoke.sh --line-picker-only # live line binding/jump/zen/paste/resize
scripts/smoke.sh --palette-only path/to/ches
python3 scripts/directory_workspace_smoke.py # directory/tab integration PTY scenarios
python3 scripts/picker_smoke.py # real file/content opening and stale/dirty navigation
scripts/dune also runs every suite (smoke.sh, theme, VCS, picker and
directory) through one dune alias, building ches.exe and the fake language server
first. Each Python suite also takes an optional binary path as its first argument.
dune build @smoke -j 4 # every suite, one at a time, every time it is asked
dune build @scripts/smoke-vcs # one suite: smoke-terminal, smoke-theme, smoke-vcs,
# smoke-picker or smoke-directory
dune build @test-all -j 4 # everything: the OCaml tests (@runtest) plus @smoke
The rules declare (universe), so dune reruns them on every request instead of
caching a pass, and share a lock, so suites never run concurrently whatever -j
is. dune runtest still does not run them. Dune points TMPDIR at a private
directory it deletes afterwards, so captures a suite keeps under TMPDIR (theme,
picker and smoke.sh review screens) are gone after a dune run; run the script
directly to keep them.
It prints ok or FAIL for each check, with a screen dump after each failure,
and exits nonzero if any check failed. It never touches your own tmux sessions,
and it deletes its temporary directory on exit. It also saves colored captures
of review screens (Normal, Insert and dirty, pending Space and Space v, a
moved tile, relative and no line numbers, and a save error at 80x24 and
160x48, plus tiny sizes and floating-palette open/close/resize/zen screens) and prints
their directory (cat a file to view it).
picker_smoke.py uses its own tmux socket and a temporary fixture, retaining
text/colored captures under the printed fixture's hidden .captures directory.
It covers file/content binding and palette activation, query/select/cancel/accept,
dirty retained text/undo, missing/stale failures, Unicode/TAB location reveal, zen
restoration, minimum/tiny/resize and interrupted paste, disk bytes and tty modes.
It also checks native Tab/Shift-Tab file/palette selected acceptance, dirty/missing/
large/empty/binary previews, safe controls, narrow/wide resize and close/reopen.
These are automated checks, not human visual or ranking/performance acceptance.
Cursor assertions poll for a visible cursor at the expected position within five seconds, rather than sampling hidden cursor coordinates during smear. This fixed the five timing failures recorded in the syntax-highlighting handoffs; three consecutive isolated runs passed all checks. Each run owns its own socket, so it cannot interfere with another smoke run. Automated checks still cannot replace the manual checks below.
Checks to do by hand¶
The smoke script cannot check these, so check them in a real terminal:
- The cursor is a block in Normal mode and a bar in Insert mode, and the shell's own cursor shape comes back after quitting from Insert mode and after an error exit. tmux does not report cursor shape.
- The colors look right: the review screens, and a live session at about 80×24 and 160×48.
- During a block insert (
Ctrl-v,2j,I, then type), the cursor's cell is blue, the other lines' insertion points are grey cells, and none of them flicker while you type, including while the smear animation runs. - Nothing flickers while typing fast, scrolling, or resizing.
- Floating palette acceptance: open
Space c cwith all docked tiles visible, and again in zen, at about 80×24 and 120×40. Check its centering, preferred/clamped size, readable title/query/results/footer, and a single bar cursor with no document smear. Filter until results scroll; navigate with Tab/Shift-Tab, accept with Enter or cancel with Escape, and confirm the covered workspace returns without a viewport jump. Resize through 14×4 and below the minimum, then grow again; review the savedpalette-*.ansicaptures. Record a human visual review separately from automated smoke/headless results. - File-preview acceptance: review the results/preview split at 104, 140 and 160 columns, then hide it at narrow widths. Check readable labels, numbered dirty text, safe control/wide-character clipping, selection visibility, Enter behavior, close/reopen and rapid navigation. Judge flicker and responsiveness separately; automated captures are not visual or measured-performance acceptance.
- Pasting from the terminal's own clipboard inserts text literally in Insert mode. This depends on the terminal; the script pastes through tmux.
- Syntax acceptance: open
highlight_tree_sitter/provider.ml,core/text_buffer.mliandREADME.mdto compare.ml,.mliand plain-text fallback. Check readability under/search/current matches, character/line/block selections and block-insert points, then clear overlays and confirm syntax returns. Insert a multiline comment above the viewport and undo/redo it; try unfinished strings/comments and malformed code. Include TABs, controls, wide/combining characters and tiny dimensions while typing, pasting, scrolling, resizing and running smear. Record observed flicker or palette problems rather than treating headless tests as visual sign-off.
Storage¶
The document is an immutable OCaml string behind the abstract Text_buffer.t.
Nonempty edits use one exact-size destination and prefix/insert/suffix blits, without
temporary prefix/suffix strings. The unified replacement path also avoids the former
delete-then-insert double copy in block editor actions. This remains O(document bytes)
copying, deliberately not a rope/piece-table implementation.
Line starts update using binary searches at the edited range's endpoints: remove
covered starts, scan only inserted text for new LFs, and shift later offsets. Changed
arrays still cost O(line count) allocation/copying; equal-length edits that remove and
insert no LFs reuse the immutable array. No unchanged document bytes are rescanned for
newlines. Inserted UTF-8 validation, CRLF/CR/NUL rejection, trailing-LF empty lines and
protected directory anchor affinities remain intact. New text invalidates its layout
cache; empty edits retain the original snapshot (except linewise identity removal).
Line lookup uses
binary search; bounded snapshot-owned sparse layouts support warm column/viewport
queries, though first access can still scan a long line.
Only Text_buffer knows how text is stored. Its interface works in byte offsets
at UTF-8 code-point boundaries and in line numbers, so it can later become a rope
or piece tree without changing the editor, keymap, or screen code.
Editing time and each undo step's memory still grow with file size. Limits are
code configuration: History.Limits.default and optional
Editor.create ~history_limits; reload/directory rebase preserve the chosen limits.
1,000 transactions permit substantial small-file work, while the 64 MiB budget
prevents long sessions retaining unlimited full-document copies. Larger documents
therefore keep fewer steps. There is no eviction notification or disk-persistent undo.
Each complete step charges 128 bytes for snapshots/step/map storage plus both
Text_buffer.retained_bytes estimates: text length, eight bytes per line-start
entry, fixed snapshot/string overhead, and protected directory scope/anchor/token
storage. Shared snapshots, including adjacent after/before texts, are charged in
full per step, deliberately overestimating shared storage without hashing or byte
scans. Identity charge is cached when metadata is normalized; history reads it in
O(1). Undo/redo moves the existing charge, never adding another copy.
After commit, complete-step charge is at most max(byte budget, newest complete step charge), with count at most the configured positive transaction limit. Undo/redo preserves that bound ("newest" means chronologically newest retained transaction, including redo). The active transaction's before snapshot is protected and outside this budget until commit; current text, saved text, registers, other application ownership and externally retained old editor/history states are also outside it. The bounded layout cache is uncharged: up to 64 line/width indexes and 16,384 checkpoint slots per snapshot, plus index/list overhead (see long-line rendering). These are retention estimates, not total RSS or peak-allocation guarantees; garbage collection releases dropped ownership on its own schedule.
History uses persistent ordered maps and incremental byte totals. Undo/redo and a commit without eviction cost O(log n); starting an active transaction and reading stats cost O(1). Removing k oldest steps costs O(k log n), bounded by the configured count; an oversized newest step replaces old roots directly, as does clearing redo on a branch. There are no recurring history-length scans or list-reversal spikes. Bounded undo retention is complete. Shared snapshots and line arrays remain charged in full, so the accounting contract is unchanged by array reuse. Equality now has safe physical snapshot/string/list identity guards; distinct snapshots still use content-and-identity equality. Dirty state therefore clears on undo-to-saved or a separately reconstructed equal saved state, rather than depending on revision equality. Comparisons of distinct equal large strings can still be O(document bytes), as can transaction no-net-change checks. Whole-string copies, line-array updates and first layout access remain architectural costs. See the slice 7b entry in the performance test plan for bounded probe results.
Saving: current limitations¶
Saving is synchronous and writes the file in place (truncate, then write). It is
not crash-safe: a crash or full disk mid-save can leave the file truncated. It
does not fsync. Symlinks are followed and kept, existing permissions are kept,
and changes made to the file by other programs are not detected.
Known limitations¶
- Grapheme clusters are not handled: cursor movement and deletion work on code points, and widths are per code point. A complex cluster such as an emoji ZWJ sequence may look wrong, but the layout around it stays aligned.
- A combining mark is drawn with the character before it only when that character is drawn as itself; after a TAB, an escape form, or the left edge of the view it is not drawn.
- No soft wrapping: long lines scroll horizontally.
- One editor group and one directory presentation. The only
:command is:e!; there is no general Ex prompt. Search and local OCaml/Verilog/SystemVerilog syntax highlighting are supported; semantic tokens, other languages and language-server features beyond diagnostics are not. Word motions use the simple character classes above, not Unicode word properties. - Large files are slow to edit and bounded whole-text undo can retain fewer steps; see Storage and Syntax highlighting. Incremental parsing still runs a full-document query and normalization after each text change.
- No configuration file: tab width, the
j kescape, and key bindings are set in code, and layout preferences are not saved between runs. - Directory buffers have no eviction or background watcher. Filesystem operations have no rollback/undo or persisted recovery journal; see the directory reference.
Known toolchain quirk: ppx_expect source path¶
ppx_expect v0.18~preview drops the directory when it registers an expect
test's file, then rebuilds the path from the bare filename plus the
-source-tree-root that Dune passes (the project root). As a result,
dune runtest fails with Sys_error "./../<file>.ml: No such file or
directory" even when every expectation passes. Each library that has inline
tests works around this in its dune file:
(inline_tests
(flags
(:standard -source-tree-root .)))
The trailing flag wins and points at the runner's working directory, where
Dune has copied the sources. Real expectation failures still produce a diff
and a nonzero exit. Remove the workaround once a fixed ppx_expect is
installed.