The TUI

An editor on the left, your note on the right, re-rendered every time you save.
cdrm tui            # the current directory
cdrm tui notes/     # a directory
cdrm tui notes/physics/relativity.cdrm   # a file, with its directory as the root

The TUI splits the terminal in two:

  • The editor, on the left, is a real terminal editor running inside the TUI. It's Helix ( hx ) by default, so your own Helix configuration, themes and keys all apply. The editor starts in the root directory, so its own file picker searches your notes too.
  • The preview, on the right, is the open note compiled for the terminal. It compiles again whenever the file changes on disk, so saving in the editor updates it. Math is drawn as images in terminals that support them; see Math images.

The bar along the top shows the open file and how far the preview is scrolled. The highlighted half is the pane your keys go to.

Opening files

Press Ctrl-p to search for a note. The finder lists every .cdrm , .mdx and .md file below the root, skipping anything your .gitignore excludes, and narrows the list as you type. If you start the TUI on a directory, the finder opens straight away.

Key In the finder
Type Filter the list (fuzzy matching: relat finds physics/relativity.cdrm ).
Enter Open the selected note.
Up , Down , Tab , Shift-Tab Move the selection.
Ctrl-p , Ctrl-n , Ctrl-k , Ctrl-j Move the selection.
Ctrl-u Clear the filter.
Esc , Ctrl-c Close the finder.

Opening a file closes the editor and starts it again on the new file.

Keys

These keys work in both panes. They're chosen to stay out of Helix's way.

Key Action
Ctrl-p Open the file finder.
Ctrl-t Switch between the editor and the preview.
Ctrl-q Quit.

Every other key goes to the focused pane. In the editor, that means the editor gets it, exactly as it would in a normal terminal.

Helix's completion menu Because the TUI uses Ctrl-p , Helix never receives it. To move up in Helix's completion menu, use the Up arrow or Shift-Tab instead.

In the preview:

Key Action
j , Down Scroll down one line.
k , Up Scroll up one line.
Ctrl-d , Ctrl-u Scroll half a page down or up.
Space , Page Down , Page Up Scroll a page.
g , Home Jump to the top.
G , End Jump to the bottom.
Esc , Enter , i Back to the editor.

When the editor closes

Quitting the editor ( :q in Helix) leaves the TUI open. Press Enter in the editor pane to start it again on the same file, or Ctrl-p to open another.

Using another editor

Set CDRM_EDITOR to the command to run. The open file's path is added after it.

CDRM_EDITOR=nvim cdrm tui
CDRM_EDITOR="hx --config ~/.config/helix/notes.toml" cdrm tui

The command is split on spaces, so arguments can't contain spaces themselves. The editor runs with TERM=xterm-256color and COLORTERM=truecolor .

Colors

The TUI's own colors (the top bar, the finder, key hints) use your terminal's palette, so they follow your terminal theme. The editor uses its own theme. For the preview's colors, see Printing notes; the preview looks the same as cdrm print .