posts : tags : programs

Led Editor

Led is a simple vi-like editor. Currently most of the intended extensions to vi are at least prototyped, but there are also regular vi features still missing. Though still incomplete, led has been my day to day editor almost since it was able to write the first buffer to disk.

Led is written from scratch without external dependencies in a Lisp. Thus the name comes from Lisp EDitor.


$ led [files or directories]

Upon startup led reads commands from a .ledrc file in the user's home directory, if one is found. If no arguments are given, led will open one scratch buffer. A scratch buffer is just like any other one, but it cannot be written unless an explicit name of the file to write it to is given.

If one or more arguments are given, they are opened to different buffers.


Led is mainly vi-compatible. If you know vi, you should be able to use led. This page mainly documents the differences.


Led typically works on several buffers, which may or may not be connected to files or directories. A new scratch buffer can be opened from a led session with :n. Similarly a new buffer to edit a file foo.txt can be opened with :n foo.txt.

Ctrl-n and Ctrl-p can be used to move between buffers. Each buffer has its own edit mode, undo history and many other properties. Copy and paste work across buffers.

In addition to scratch and file buffers, led makes heavy use of directory buffers. A directory buffer simply lists the contents of a directory in the buffer. A typical way to open a directory buffer is $ led ..

Enter, the Plan 9 influence

Plan 9 had a text editor called Acme. In Acme one could type text into the editing window and call it. This idea has been borrowed to led.

Text in any edit buffer can be used as a command. There are currently only a few such commands, but even these have proven to be surprisingly useful.

Open/close directories/files

Pressing enter on a line which points to an existing file in current working directory opens that file in a new buffer, or jumps to the corresponding buffer if it is already open. The line may optionally be followed by a colon and position or search, which will also pinpoint a position within the file.

Pressing enter on a line which points to a directory will either open the contents of the directory to subsequent lines in the current buffer, or remove them if they are found.

Search content

When enter is pressed on a word that does not point to a file or directory, the command is interpreted as a search. This is done by looking at the first buffer for any directories or files, and searching for the content in them.

The results of the search are simply a new text buffer, which uses the same file addressing structure used in directory listing. Consequently, pressing enter on a search result will jump to the matched location.

The naive search may easily take too long if your working directory has e.g. large binary files. Therefore the search stops after a preset 10 second timeout.

Example Usage

Go to project directory and $ led ..

Use enter to browse the directory and find the directories/files you are going to work with. Copy them aside and remove unnecessary files or directories.

Make notes to the initial directory buffer, since it's just text.

Add file links with search commands to find some places quickly.

If you run out of hacking time while working on something, write the initial directory buffer with relevant files and notes to a file. Next time you can open it and resume working.

Non-standard keybindings

Arrow keys do not work. This is intentional. You should be using hjkl.

u undoes the last edit operation, if applicable.

Ctrl-r redoes the last undone edit operation, if applicable.

Ctrl-w writes a (file) buffer to disk regardless of input mode

Example .ledrc

set ai
set tabstop=3
set expandtab
set showmatch
set sw=3
set utc-offset +2.0
set recursive-open-directory=off
ab zl λ
ab xzar →

#project #led