This tutorial introduces Leo's basic features. It has 8 parts:

  1. Outlines and Nodes

    In brief: outlines consist of nodes. Nodes consist of headlines, body text and optional user data. User data is available to scripts, but is not visible in the outline.

  2. Clones and Views

    In brief: A clone is a "live" copy of a node. Using clones, any node may appear in many places in the outline. A view is a node containing other nodes, including clones. Thus, an outline can contain arbitrarily many views of the data it contains. You never need to choose between different views of your data. You can have them all.

  3. External Files

    In brief: @auto, @file, @shadow and @thin nodes (and their descendants) manage external files. @file and @thin nodes create external files containing special comments called sentinels. Using @thin is recommended whenever possible. External files managed with @shadow and @auto contain no sentinels--Leo automatically imports the external file when reading a .leo file.

  4. First Steps for Newbies

    In brief: Leo's File:Open command creates @edit nodes. These nodes are much like Emacs or vim buffers. Leo settings files allow total control over settings.

  5. The rst3 and ipython plugins

    In brief: The rst3 plugin integrates outline structure with reStructuredText. The ipython plugin allows Leo scripts to control IPython, and allows IPython scripts to control Leo.

Sections 6, 7 and 8 are for programmers. You may skip them if you like.

  1. Commanders, Nodes and Positions

    In brief: Nothing in Leo is just text. All data in Leo is a true Python object. Leo's DOM (document object model) consists of commanders, nodes and positions. Saving a .leo files saves these objects. Leo's execute-script command predefines c, g and p: c is the outline's commander, g is Leo's utility module,, and p is the position of the presently selected node. c.allNodes_iter is an iterator returning all nodes of the outline. p.h, p.b and p.u are the headline, body text and user data of the node at position p. Internally, Leo represents nodes using two separate data structures, the vnode p.v and the tnode p.v.t. A position represents a state of a tree traversal: a node may appear at many distinct positions in an outline.

  2. Script Buttons and Node Types

    In brief: Scripts can create new minibuffer commands, with key bindings. Script buttons bring scripts to data. Headlines can be considered metadata describing the body text. By convention, headlines starting with '@' specify types. Leo scripts give meaning to types. For example, the run-unit-tests-locally command converts the body of @test nodes into an instance of unittest.TestCase? and runs that test case.

  3. Directives and Sections

    In brief: Leo directives specify properties of a node and its descendants. Directives may be inherited or overridden in descendant nodes. Leo can generate scripts by traversing (a part of) an outline! The @others directive tells where to place the expansion of unnamed child nodes in the generated script. Section references of the form <<section name>> tell where to place named child nodes. All parts of Leo generate scripts automatically as required.