Code Editor | Liu Terminal

Liu Terminal Code Editor: a tab with an explorer rail, syntax highlighting for more than 50 languages, find and replace, and a status bar with position, language, line ending and encoding.

The Code Editor turns a tab into a small IDE next to your agents, so you can read and fix the files they touch without switching apps.

Open the editor

  • Click a code or text file in the file browser. It opens in the viewer beside the terminal, ready to edit.
  • ⌘ K → Code Editor gives the editor a whole tab. If the sidebar viewer holds a document, that document moves into the tab; otherwise the tab opens at the focused pane's working directory.
  • Right-click a file in the list and choose Open in Editor to give that file a tab of its own.

In a tab, the file list docks as a narrow explorer rail on the left and the document fills the rest. Every row and the tab itself carry a file-type icon. Long lines scroll sideways, and the view follows the caret.

Syntax highlighting

One table-driven highlighter covers more than 50 languages and recognizes files by over 400 extensions and names, such as Makefile, Dockerfile and go.mod. The editor, the git diff dock and fenced code blocks in the Markdown reader all use it, so a file and a code block in the same language look the same.

  • In Vue, Svelte, Astro and HTML files, and in templates such as Jinja, ERB and EJS, the code inside <script> and <style> is highlighted by the same rules as a .js or .css file.
  • Block comments, multi-line strings and template literals carry their state from line to line.
  • A .patch or .diff file tints added and removed lines.

Editing

Click to place the caret, double-click to select a word and triple-click to select a line. Shift-click extends the selection, and dragging selects; drag past the edge to scroll. Shift with any motion key below extends the selection too.

ShortcutAction
⌘ SSave
⌘ Z / ⌘ ⇧ ZUndo / redo
⌘ ASelect all
⌘ C / ⌘ XCopy / cut the selection, or the whole line when nothing is selected
⌘ VPaste, replacing the selection
⌘ DDuplicate the line
⌘ /Comment or uncomment the lines
⌘ ] / ⌘ [Indent / outdent the lines
Tab / ⇧ TabIndent the selected lines or insert four spaces / outdent
⌘ Enter / ⌘ ⇧ EnterNew line below / above
⌥ ↑ / ⌥ ↓Move the lines up / down
⌘ ← / ⌘ →Start / end of the line
⌘ ↑ / ⌘ ↓Start / end of the document
⌥ ← / ⌥ →Move by word
⌘ ⌫Delete to the start of the line
⌥ ⌫ / ⌥ ⌦Delete the word before / after the caret
⌃ KDelete to the end of the line
Page Up / Page DownMove one screen up / down

The usual macOS text keys work too: ⌃ A and ⌃ E go to the start and end of the line, ⌃ F, ⌃ B, ⌃ P and ⌃ N move the caret, and ⌃ D and ⌃ H delete.

Find and replace

The find bar searches as you type, highlights every match and counts them. Matching ignores case. While the bar is open, its keys come before the editor's.

ShortcutAction
⌘ FOpen Find
⌘ ⇧ F / ⌘ ⌥ FOpen Find and Replace
Enter / ⌘ GNext match
⇧ Enter / ⌘ ⇧ GPrevious match
TabSwitch between the Find and Replace fields
EnterIn the Replace field: replace this match and go to the next
⌘ EnterReplace all
⌘ VPaste into the field, not the document
EscClose the bar; the caret stays on the current match

Status bar

The bar under the document shows the caret position on the left (Ln 42, Col 17) and the language, line ending and encoding on the right, for example TypeScript · LF · UTF-8. An extension Liu does not know is shown in capitals, and a file with no extension reads Text.

The line ending is the one the file was read with, LF or CRLF, and Enter keeps writing it.

Saving and unsaved changes

  • ⌘ S saves. The title marks a document with unsaved changes.
  • If you close the document, open another file or quit with unsaved changes, Liu refuses once and says why. Repeat the action to discard the changes.
  • Liu does not save over a file that changed on disk since you opened it, for example one an agent rewrote, until you save again. A document without edits reloads when its file changes.

Git changes

With the status bar on (⌘ K → Toggle Status Bar), a terminal tab inside a git repository shows its branch and the added and removed line counts. Click that segment to dock the working tree's diff on the right, highlighted by the same rules as the editor. ⌘ K → Toggle Git Changes hides or shows the segment.

Limits

  • Files larger than 2 MB do not open in the editor.
  • The editor works on local files. Files on an SFTP host can be browsed and transferred, not edited in place.
  • Find highlights up to 8192 matches.

Markdown files open in the Markdown reader, where Edit mode uses the same keys and adds Markdown formatting.

Documentation

Getting started

Agents

Terminal

Files and notes

Web projects

Reference

Other languages

Türkçe · 简体中文 · 한국어 · Español · Deutsch · Italiano · Français · 日本語 · العربية