Use the CLI

View

Open a file, a directory, or a patch with tooee view, and force a renderer.

tooee view README.md

View opens the file, picks a renderer from the extension, and puts the file name in the title bar. Move with j and k, search with /, quit with q. The full key list is in Keyboard basics.

Tooee View displaying a Markdown quick-start code block and a keyboard-shortcuts table in a dark terminal theme.

View renders Markdown code blocks and tables with cursor navigation.

Open a file

The extension picks the renderer:

ExtensionRenderer
.md, .mdx, .markdownmarkdown
.csv, .tsvtable
.diff, .patchdiff
.png, .jpg, .jpeg, .gif, .webpimage
.ts, .tsx, .js, .jsx, .json, .py, .rs, .go, .rb, .java, .kt, .swift, .c, .h, .cpp, .hpp, .css, .html, .sql, .sh, .bash, .zsh, .toml, .yaml, .ymlcode, with syntax colours for .ts, .tsx, .js, .jsx
anything elsetext

A file with another extension that contains a unified patch, with diff --git or --- and +++ headers and at least one @@ hunk, opens as a diff.

Markdown files resolve relative image paths from the folder of the file. L toggles line numbers. When the cursor is on a wide code block inside markdown, h and l scroll that block sideways.

In a Markdown file, click a link to a local file, or put the cursor on its line and press Enter. View opens the linked file in the same session. When the line holds more than one link, Enter opens a chooser that lists each link by its text and destination. Backspace in cursor mode returns to the previous file, and so does Go back in the : palette.

A link with a fragment, such as install.md#bun, opens at the top of the file. A link to a missing file or a directory shows a warning toast. Other links, such as web URLs, show Unsupported link. Content from stdin has no source file, so its links show Links need a source file. Links in table cells follow the same rules. They also carry an OSC 8 hyperlink, so a terminal with OSC 8 support can open them.

Fold sections

In a Markdown file, the fold keys hide the blocks under a heading. They work in cursor mode:

KeyAction
z aOpen or close the fold at the cursor
z cClose the fold at the cursor
z oOpen the fold at the cursor
z zOpen the fold at the cursor when it is closed, else close it
z MClose all folds
z ROpen all folds

A heading folds every block up to the next heading of the same or a higher level. The fold at the cursor is the smallest section that holds the cursor. A closed heading shows ⋯ N blocks, and the gutter keeps the block numbers of the whole document. j, k, search, copy, and clicks skip the hidden blocks. When a fold closes over the cursor, the cursor moves to its heading.

Show the heading outline

tooee view --outline README.md

--outline opens a list of the Markdown headings in a panel on the right. The document keeps the focus. The heading that holds the cursor is marked, so the outline follows you through the document. g o gives the outline the focus, and opens it first when it is closed. The outline needs a terminal at least 60 columns wide. In a narrower terminal it is hidden, and g o shows The outline needs a wider terminal.

While the outline has the focus:

KeyAction
j, k, down, upNext and previous heading
g g, GFirst and last heading
EnterMove the document cursor to the heading and return to the document
EscapeReturn to the document and keep the outline open
g oClose the outline
z a, z c, z o, z zAct on the fold of the selected heading

A jump opens the closed folds that hide the heading and puts it three lines below the top of the view. A click on a heading jumps too. view-outline.ts opens a long document with the outline shown at start.

Force a renderer

tooee view --renderer text README.md
tooee view -r table data.txt
tooee view --renderer=code notes

Values: markdown, code, text, table, diff. An unknown value prints Unknown renderer with the list and exits with code 2. A flag without a value prints Missing value for --renderer and exits with code 2.

The table renderer accepts a JSON array of objects, TSV when the first line has a tab, or CSV. The first row of CSV or TSV gives the column names.

Read a diff

git diff > changes.diff
tooee view changes.diff

The diff renderer adds keys of its own:

KeyAction
sSwitch between split and unified layout
wToggle line wrapping
], [Next and previous file
fOpen the file picker
h, lPan sideways while wrapping is off

Open a directory

tooee view packages/view/src

View lists the files in the directory that it can open, sorted by name, and shows the first one. It skips hidden files and subdirectories. The title bar shows the file name and its position, for example view.tsx (5/9). In cursor mode, g n moves to the next file and g p to the previous one. A directory with no openable files shows No viewable files in directory; q quits.

--renderer and a directory together print an error and exit with code 2.

Pipe into View

With no path, View reads the content from stdin:

git diff | tooee view --renderer diff
cat data.csv | tooee view --renderer table

Keys come from the controlling terminal, so the screen stays interactive after the pipe closes. CLI reference lists the terminal channels and exit codes.

Next

On this page