Skip to content
xted GitHub
ITEN
Feature index

Features

xted is a non-modal editor written in C99 with nothing but the POSIX C library: no ncurses, no other library. Everything on this page is built into the editor.

The recordings on this site show the interface in English. xted also speaks Italian: it does so by itself on an Italian system, or with language = it in the config file.

Terminal and interface

xted drives the terminal by hand, with termios and ANSI/VT100 sequences.

Screen and input

  • It uses the alternate screen: on exit the terminal is as it was. It is also restored on SIGTERM, SIGHUP or a crash.
  • Only changed rows are redrawn, with a single write per frame, and window resizing is followed.
  • Full UTF-8, with the right width for wide characters (CJK, emoji).
  • 24-bit, 256 or 16 colors, chosen from COLORTERM and TERM or by hand; NO_COLOR turns them off.
  • Bracketed paste: text pasted by the terminal is not read as keys. The mouse uses SGR events.
  • Alt and Ctrl keys are recognized in the forms of xterm, PuTTY and rxvt.

The symbols of the interface (▸ ▾, │, ● ○) are chosen with Glyphs or with glyphs in the config: unicode (default), windows (► ▼, for PuTTY or KiTTY with a limited font) or ascii.

Over SSH COLORTERM rarely arrives, so PuTTY gets 256 colors. For 24-bit color, write colors = truecolor in the config on the server.

At the top, as in desktop applications: File, Edit, Selection, Search, View, Tools, Markdown (only in a Markdown file), Options, Help. Each item shows the shortcut in use, items that make no sense right now are grayed out, and active settings carry a ✓.

  • With the mouse: a click opens a menu, a click on an item runs it.
  • From the keyboard: F10 opens the menu used last, Left and Right change menu, Up and Down choose, a letter goes to an item, Enter runs it, Esc closes.
  • On the right are buttons to go back and forward in the jumps, Save, Undo, Redo and Find.
  • In a narrow terminal the buttons go first, then the last menus; under 10 rows the bar is not shown. menubar = off hides it, and F10 shows it while a menu is open.

Key bar

The bottom row shows the keys that are useful right now, with your current shortcuts, and with the mouse they are buttons. It changes with the context: typing, selection, suggestions, lists, questions, search, file browser, multiple cursors, snippets, pane resizing. Markdown, JSON and code files add the keys of the language. With keybar it lives in the message row (message), in a row of its own (line) or is hidden (off).

Command palette

Alt+X lists every command, narrowed down as you type part of a name. With an empty search the commands are in sections, actions first and then settings, with the current value (● on, ○ off) and the shortcuts. Enter on an action runs it; on a setting it changes it and leaves the palette open. The full list is on the Commands page.

Status bar

File name, language, line ending, encoding, indentation, line and column. Next to the name it shows where the cursor is ("in Class::method") and, inside a call, the signature with the current parameter. The message row shows questions, confirmations and errors.

Mouse

Click to place the cursor, double click for the word, triple click for the line, drag to select, wheel to scroll, Alt+click for another cursor, Ctrl+click to go to a definition, click on tabs and lists, drag the borders of panes and browser. mouse = off turns it off.

Help

F1 opens the help page: version and credits, every command with its current shortcuts, the keys of lists and search, the files in use. When there is nothing to reopen, a start screen appears and goes away at the first key.

Files and buffers

Opening files

xted app.c:120 opens the file at line 120 (:120:5 at the column too). Several files become several buffers, shown as tabs. A directory opens the file browser, xted - reads from stdin. All the options

  • Quick open (Ctrl+P): fuzzy search of the files of the project. The list opens at once and fills while the folder is read.
  • Recent files (Alt+Shift+P): the last 100 files opened in any folder, reopened where the cursor was.
  • List buffers (Ctrl+E): the open buffers with name and path, filterable. A * marks unsaved changes.

File browser and panes

Ctrl+B shows the file browser, with folders you can open and close. While it is active: Ctrl+N creates a file, F7 a folder, F2 renames or moves (open buffers follow), Del deletes a file or an empty folder after a question.

Panes split vertically (Alt+\) and horizontally (Alt+-), also on the same file. Borders are resized with the mouse, or with Alt+E and the arrows.

The file browser with Ctrl+B, quick open with Ctrl+P, then a vertical and a horizontal split.

Saving and safeguards

  • Atomic save (temporary file and rename) that keeps permissions; save, save as, save all.
  • Confirmation before closing unsaved files, a warning when the file changed on disk, read-only files handled, a warning for binary files.
  • LF or CR LF, and a missing final newline, are detected and kept.
  • Optionally, saving removes trailing spaces (trim_trailing_space) or adds the final newline (final_newline).

Encodings

The text is UTF-8; a file in another encoding opens as text and is saved back as it was. The encodings handled:

  • UTF-8, also with a BOM;
  • UTF-16 LE and UTF-16 BE, known by their BOM;
  • Windows-1252, for files that are not valid UTF-8: every byte goes back to the file as it was;
  • ISO-8859-1 (Latin-1), when the charset of .editorconfig says so or you choose it.

Reopen with encoding reads the file again in another encoding; Save with encoding (also a click on the encoding in the status bar) converts it. When the encoding cannot write a character, saving offers UTF-8.

Unnamed buffers are kept

The text of buffers with no file is written a few seconds after each change to ~/.local/state/xted/unsaved/. Quitting asks nothing for them, and they come back the next time you start xted, from any folder. Closing one with Ctrl+W asks as usual. When several xted are open, the first one keeps them. keep_unsaved = off turns this off.

Crash recovery

Unsaved changes of named files are copied at most every 2 seconds (less often for big files) to ~/.local/state/xted/recover/. The copy goes away when you save or quit normally; it stays after a crash, a closed terminal or a dropped SSH connection.

When you reopen the file, xted asks whether to recover: y brings the changes back (one Ctrl+Z returns to the file on disk), n discards the copy, Esc leaves it for later. Recover files lists the copies left. A file already open in another xted is reported. recover = off turns it off.

When a file is reopened after xted was closed abruptly, the bottom line asks: “Recover the changes to «service.py» not saved?”
When a file is reopened after xted was closed abruptly, the bottom line asks: “Recover the changes to «service.py» not saved?”

A session per folder

Started without arguments, xted reopens the files and cursors of that folder's last session, with the panes and the AI chat if it was open (text and conversation).

Single instance

xted --remote file… hands the files to the xted already open, which opens them as new buffers, and exits at once. The icon and the desktop's "Open with" use it. Without --remote every xted is on its own; single_instance = off stops it from receiving files.

Editing

Movement and selection

Arrows, Home and End (Home goes first to the first non-blank character), PgUp and PgDn, word by word with Ctrl and the arrows, start and end of the file. Shift plus movement selects; there are commands to select all, the line or the word.

Clipboard

Copy and cut work on the whole line when nothing is selected. Alt+V pastes the previous entry; Alt+Shift+V opens the history of the last 32 copies, filterable, where Del removes one. The history stays in memory and is never written to disk.

With clipboard = on (default) copies also go to the desktop clipboard:

  • on Windows, the Windows clipboard;
  • on Linux in a local graphical session, through wl-copy/wl-paste, xclip or xsel;
  • over SSH, or without those programs, through OSC 52, if the terminal supports it (Windows Terminal, kitty, WezTerm, foot, Alacritty, Konsole, xterm; not VTE-based terminals such as GNOME Terminal). To paste, use the terminal's Ctrl+Shift+V.

Lines, words, case

Undo and redo are unlimited, with consecutive edits grouped. You can duplicate, delete, join and move lines; delete the word before or after the cursor; turn the selection or the word to upper case (Alt+Shift+U), lower case (Alt+Shift+L) or use Capitalize words, with Greek and Cyrillic letters too. Alt+/ comments and uncomments as the language does. Ins switches to overwrite mode.

Multiple cursors

Ctrl+D adds the next occurrence of the word, Alt+D all of them, Alt+Shift+Up and Alt+Shift+Down a cursor above or below, Alt+click one where you click.

Ctrl+D and then Alt+D select the occurrences of a name, which changes everywhere at once.

Numbers, invisibles, wrapping, folding

  • Line numbers (Alt+G): a click on a number selects the line, a drag selects several.
  • Show invisible characters (Alt+J): line ends ↵ (LF) or (CR LF), tabs →, trailing spaces ·.
  • Wrap long lines (Alt+Shift+Z): on for Markdown and plain text, off for code. Continued rows are indented like the line or the list item; the text does not change.
  • Block folding (Alt+Z), by brackets or indentation.

Filter through a command

Alt+K sends the selection to an external command, such as sort, and replaces it with the output.

Find and replace

Ctrl+F searches incrementally and highlights every match. Alt+C is case sensitivity, Alt+W whole words, Alt+R POSIX extended regular expressions, with capture groups in the replacement (not on Windows). F3 and Shift+F3 go to the next and previous match.

Ctrl+R replaces, asking at each match (yes, no, all, done), also within the selection only.

Find in files

Alt+F searches the files of the project and lists the results for you to walk through.

Incremental Ctrl+F with a regular expression, Ctrl+R with confirmation, then Alt+F in files.

Jumps and their history

Ctrl+G goes to a line and column, Alt+M to the matching bracket, Ctrl+Home and Ctrl+End to the start and end of the file. As in a browser, Alt+Shift+Left goes back to where you jumped from and Alt+Shift+Right forward again: it covers symbols, definitions, lines, searches, errors and moves between files, up to 100 places per session.

Programming

Highlighting, indentation, suggestions and jumps to definitions are built in: no language server is needed.

Syntax highlighting

31 languages, recognized by extension, file name, shebang and modeline:

  • C/C++
  • Python
  • JavaScript
  • TypeScript
  • Shell
  • Markdown
  • PHP
  • HTML
  • PHP/HTML
  • XML
  • CSS
  • JSON
  • YAML
  • TOML
  • SQL
  • Go
  • Rust
  • Java
  • C#
  • Ruby
  • Makefile
  • Dockerfile
  • Diff
  • Dotenv
  • Lua
  • Kotlin
  • Swift
  • Perl
  • INI
  • Batch
  • PowerShell

INI covers .cfg, .desktop, systemd units, .gitconfig and .editorconfig. Multi-line constructs and embedded languages (JavaScript and CSS in HTML, HTML in PHP) are handled. Variables inside strings have their own color, and the code in an interpolation is colored like the rest. The matching bracket is highlighted.

You can add a language with a text file in ~/.config/xted/syntax/, without recompiling.

Indentation and pairs

  • Auto and smart indent: one more level after {, (, or : in Python, one less at the closing.
  • Tab and Shift+Tab indent or unindent the selection.
  • Automatic pairs for ( [ { " ': typing the closing one steps over it, Backspace in an empty pair removes both, a selection gets wrapped. Not inside strings and comments.
  • The style (tabs or N spaces) is detected from the file; you can change and convert it from the palette.

Suggestions

While you type, a popup offers members after ->, :: and ., symbols of the file, of included files and of the standard library (PHP, C, C++, Python, JavaScript, TypeScript, Go, Rust, Java, C#), words of the other buffers, keywords and snippets. Each row shows the signature and a letter for the kind: f function, c class, m method, p property, k constant, v local variable.

  • Tab accepts, Enter takes the highlighted item, Esc closes.
  • Inside a call, local variables and parameters come first; where a parameter type goes, types are offered.
  • Confirming a function turns its arguments into placeholders.
  • Where a program reads an environment variable (env(', process.env., os.getenv(', $ in Shell…) the variables of the .env* files are offered, with the file name and without the value.

Automatic imports

When you accept a symbol that is not imported yet, xted adds what is needed, in the style of the file and in the right group. One undo removes both the import and the text.

LanguageWhat it addsFrom your project
C, C++#includefunctions, types, macros and variables of headers not yet included
Pythonimport, from … importdefinitions of the other modules
JavaScript, TypeScriptimport or require, as the file doesexports of the other files
Goimport block, as goimports doesexported names of the module's packages (go.mod)
Rustuse, as rustfmt doespub items of the crate's other modules
Javaimportpublic classes, respecting Maven and Gradle modules
C#usingtypes of other namespaces, respecting project references
PHPuse, use function, use const, require_onceComposer classes (PSR-4), Laravel aliases and facades
In Python and Go, a symbol is picked from the popup and the import line appears in the right group.

Symbols and definitions

Go to symbol (Ctrl+T) lists classes, functions, methods, properties and constants of the file, with parameters and line, filterable.

Go to definition (F12 or Ctrl+click) opens the right file and puts the cursor on the name. A method is looked up in the class of the object and its base classes, a variable leads to the class of its instance, in C the body wins over the prototype. With several definitions you pick from a list. When the index finds nothing, a ctags tags file is used if there is one.

Ctrl+T, then F12 on a method defined in another file, and back with Alt+Shift+Left.

Snippets

Type the name of a snippet (such as for) and accept it: Tab moves from field to field, and what you type in a field is repeated where the same field appears. Besides the built-in ones there are yours (~/.config/xted/snippets/) and the project's (.xted-snippets/ and .vscode/*.code-snippets), which win over yours. VS Code snippets are read too; their regular expression transforms are not applied.

# Loop with an index
snippet fori
for (${1:i} = 0; $1 < ${2:n}; $1++) {
	$0
}
endsnippet

disable while
  • $1, ${2:default} are the fields in order, $0 is where it ends; ${1|one,two|} is a choice.
  • VS Code variables such as $TM_FILENAME, $TM_SELECTED_TEXT, $CLIPBOARD, $CURRENT_YEAR are filled in.
  • Insert snippet, Snippet from selection, Edit snippets and Copy a built-in snippet are in the Edit menu. The file is checked when saved.

Macros

F9 starts and stops recording (the status bar shows [REC]), Shift+F9 plays it back. Every key is recorded, also in questions and prompts, and pasted text; the mouse is not.

  • Play macro several times…: 0 repeats as long as the cursor moves to a later line, up to the end of the file.
  • Play macro on each selected line: runs it from the start of each selected line.
  • One Ctrl+Z undoes a whole playback.
  • Save macro… keeps it in macros/; Macros… lists them.

A .macro file is text, one action per line:

# xted macro
home
type - 
end
type ;
paste text\non two lines
cmd save
down
F9 records an edit, then Play macro on each selected line repeats it on the selected lines.

AI

xted contacts no service by itself: it uses a program that reads the request on stdin and writes the answer to stdout, named by ai in the user's config (never in a project .xted). Keys, model and connection stay with that program. With no configuration, the first AI command offers claude -p and writes it only if you accept; otherwise nothing is sent.

ai = claude -p                      # Claude Code
ai = llm -m claude-sonnet-4.5       # llm
ai = ollama run qwen2.5-coder       # a local model with Ollama
ai = ~/bin/my-ai                    # a script of yours

The request holds the file name and language, the file (at most ai_context lines around the part, 2000 if not set) and the selection or, with none, the function at the cursor. The answer arrives while you keep typing.

  • Change with the AI… (F2): say what to change; Up and Down bring back earlier instructions. The proposal shows as differences: Enter applies, Esc discards. If the file changed meanwhile, it is not applied.
  • AI chat (Shift+F2): a conversation in a pane; Enter on a code block inserts it in the file. F4 moves it beside or below.
  • Explain with the AI, Document with the AI, Fix the error with the AI (the last error reached with F8), New AI chat, Stop the AI.

To use several models, name them in the [ai] section; AI model… picks, adds and edits them.

ai = sonnet

[ai]
sonnet = claude -p --model sonnet
opus   = claude -p --model opus
local  = ollama run qwen2.5-coder
F2, an instruction, the proposal as a diff; Enter applies it and Ctrl+Z takes it back. The answer is a sample: in real use it comes from the configured program, such as claude -p, llm or ollama.
Shift+F2 opens the chat below the text, F4 moves it beside, Enter inserts a code block in the file. The answer is a sample: in real use it comes from the configured program.

Markdown

Markdown preview (Alt+U) opens the rendered preview beside the document: headings, bold, italic, strikethrough and code in real styles, underlined links with their address, lists and checkboxes, quotes, highlighted code blocks, aligned tables, the text in place of images. It updates as you type, follows the cursor and is read-only.

  • Shortcuts for bold, italic, code, links, headings and lists: the list.
  • Suggestions offer syntax at the start of a line, languages after ```, files inside a link and heading anchors after ](#.
  • Enter continues lists and quotes; on an empty item it ends the list.
Alt+U opens the preview, which follows the text as it is typed.

JSON, YAML and Dotenv

JSON: keys have their own color, Ctrl+T lists keys at every level. Check JSON moves to the first error and says what it is; Format JSON and Compact JSON rewrite the document in a single undo step. Invalid JSON is still saved, with a note. Comments are accepted (the text is then not reformatted); a trailing comma only in .jsonc, .json5, tsconfig*.json and the like.

YAML: keys, comments, anchors, references, tags and | and > blocks are colored; Ctrl+T lists the keys.

Dotenv: .env, .env.*, *.env and .flaskenv, with variable names and values colored; Ctrl+T lists the variables.

Check JSON finds an error, then Format JSON tidies the document.

Tools

Commands and errors

Alt+R runs a shell command and shows its output in a pane; F5 repeats it, Shift+F5 stops it. F8 and Shift+F8 jump to the next and previous error, in the file:line:column format of gcc, tsc and Python.

Alt+R runs a command that fails and F8 goes to the faulty line.

Git

If the git command is there, the margin marks added, changed and deleted lines. Who changed this line (Git blame) (Alt+Shift+B) shows commit, author, date and subject of the line, unsaved text included. Compare with the last commit (Git) (Alt+Shift+D) opens the differences from HEAD; Enter on a line goes to that line in the file, and the pane is refreshed on each save.

The markers in the margin, the blame of a line with Alt+Shift+B and the diff with Alt+Shift+D.

Format on save

With the format key (off until you write it) Ctrl+S sends the text through a formatter and saves what it returns; Ctrl+Z brings the old text back. format = auto uses what the project declares:

LanguageIf the project hasRuns
PHPpint.json or vendor/bin/pintpint -q %t
PHP.php-cs-fixer.php or .php-cs-fixer.dist.phpphp-cs-fixer fix --quiet %t
Python[tool.black] in pyproject.tomlblack -q -
Python[tool.ruff], ruff.tomlruff format --stdin-filename %f -
JS, TS, CSS, JSON, Markdown, YAML, HTML.prettierrc*, prettier.config.*, "prettier" in package.jsonprettier --stdin-filepath %f
C, C++.clang-formatclang-format --assume-filename=%f
Goalwaysgofmt
RustCargo.toml (with its edition)rustfmt --emit stdout

The program in vendor/bin or node_modules/.bin wins over the one in PATH. You can also write your own command: it gets the text on stdin and returns it on stdout; %f is the file path, %t a temporary file the program rewrites, %% a %. If the formatter is missing, fails or takes more than 10 seconds, the file is saved as it is. Format document (Alt+Shift+F) formats without saving; Save without formatting skips the formatter once.

Themes

Alt+T opens the list: the highlighted theme shows at once, Enter keeps it, Esc goes back. To keep it for good, use Save settings… or the theme key.

The 10 built-in themes

ThemeLook
darkdark, on the terminal's own background (the default)
lightlight, gray
norddark, cool blue-gray
draculadark, vivid colors
gruvbox-darkdark, warm tones
contrastblack with sharp colors, for maximum legibility
dos-blueblue background and gray bars, like the DOS editors
gruvbox-lightlight, cream
github-lightlight, white background
solarized-lightlight, ivory and low contrast

The colors of nord, dracula, gruvbox-*, solarized-light and github-light follow Nord (Sven Greb), Dracula (Dracula Theme), Gruvbox (Pavel Pertsev), Solarized (Ethan Schoonover) and the light theme of GitHub (Primer), all under the MIT license; a few shades are retouched.

Live theme editor

Edit theme opens a panel on the right with the colors of the theme in use and two sample pages, PHP code and Markdown. Every change shows at once; the panel keeps the starting colors, so it stays readable even after a bad one.

  • Enter opens the palette: the colors of the theme, grays, and twelve hues in six lightnesses.
  • Left and Right change hue, saturation or lightness; # types the color as #rrggbb.
  • Ctrl+S saves the theme under a name and puts it in use.
Alt+T with the theme preview, then Edit theme with the palette.

Themes written by hand

A file in ~/.config/xted/themes/ with key value lines and #rrggbb colors: name, foreground, background (or none), one line per syntax class, match, popup, popup_sel, git_add, git_mod, git_del. What is missing comes from dark; a theme named like a built-in one takes its place.

Configuration

xted works with no configuration file. If you want to change something, the folder is $XDG_CONFIG_HOME/xted or ~/.config/xted (on Windows %APPDATA%\xted):

~/.config/xted/
├── config          settings and shortcuts
├── syntax/         more languages
├── themes/         more themes
├── snippets/       your snippets
└── lang/           translation catalogs

The config file

key = value lines, comments with #. Keys before the first section apply to all languages, a [Language] section changes them for that language, [keys] holds the shortcuts. All the keys

theme = light
line_numbers = on
format = auto

[Python]
expand_tab = on
indent_width = 4

[keys]
ctrl+shift+d = duplicate_down
alt+y = none              # removes a shortcut

The project .xted file

Same format, in the project folder; the one nearest to the file is used. Its language keys win over the user's file. Global keys (theme, mouse, Git, clipboard) are read at start from the .xted nearest to the first file opened.

.editorconfig

Read from the file's folder upwards until root = true. Keys used: indent_style, indent_size, tab_width, trim_trailing_whitespace, insert_final_newline, charset. Globs support *, **, ?, [], {a,b}, {1..3}.

Order of precedence

For each setting of a document, strongest first:

  1. a command given in the session;
  2. the project's .xted;
  3. the values written in the user file;
  4. .editorconfig;
  5. the style found in the text;
  6. the defaults.

Saving from the palette

Save settings… writes what you changed with commands, without opening any file. You choose where: the user file (global or for the language), the project .xted, or .editorconfig (indentation only). It warns you when a stronger file would override the destination, and keeps comments and order.

Shortcuts

All of them can be changed, in the [keys] section or with Keyboard shortcuts…, which searches by name or key and has "Test a key…" to see what your terminal sends. How to remap

Interface language

The texts are English in the code; translations are external files, and today there is an Italian one. language = auto (default) reads LC_ALL, LC_MESSAGES and LANG; you can write en or it, or use the Language command. Adding a language takes a file in ~/.config/xted/lang/, one English text<TAB>translation line each, with no recompiling.

Desktop and Windows

Linux desktop

Installing adds an icon and an entry in the application menu, xted in "Open with" for text files, and "Open with xted" in Dolphin and Nemo. If an xted is already open, files go there; otherwise a terminal opens, the one named by terminal in the config, by $TERMINAL or by your desktop. With Ptyxis, kitty, Alacritty, foot and WezTerm the window shows the xted icon in the dock.

Windows

On Windows 10 (1809 or later) and 11, xted is a single xted.exe with no DLL to install, in Windows Terminal, PowerShell or the Command Prompt. Installing adds a Start menu entry, "Open with", "Open with xted", "Open folder in xted" and "Open xted here".

  • Commands run through cmd.exe; Git markers need Git for Windows in PATH.
  • Search has no regular expressions.
  • Configuration is in %APPDATA%\xted, sessions in %LOCALAPPDATA%\xted.
  • File names outside ASCII need Windows 10 1903 or later.

Performance and quality

The goals written in xted's specification:

  • a single binary under 1 MB, checked at every release;
  • startup under 50 ms;
  • under 5 MB of memory at rest with a small file open;
  • a 10 MB file opens in under a second;
  • no needless background work: the program waits for input;
  • compiles with no warnings under -Wall -Wextra -pedantic, automated tests also with AddressSanitizer and UBSan, trials on a real pseudo-terminal.

Planned

Not available yet: block (column) selection, bookmarks, LSP client (optional), inline AI completion, relative line numbers, ruler, indentation guides, end_of_line from .editorconfig, inserting a character by Unicode code, Valgrind checks.