Skip to main content

Your first cell

In this step you create a library, open it in Neovim and the GUI, and draw two rectangles.

Create a library​

arc new tutorial
cd tutorial

This creates three files:

tutorial/
├── Argon.toml # library manifest
├── tech.toml # units, layers, and display styles
└── lib.ar # Argon source

lib.ar starts with an empty top() cell. A cell is a layout definition you can call, like a parameterized block.

Open the editor​

From the library directory:

argone .

This opens a window with Neovim on the left and the GUI on the right, and starts the analyzer. Neovim owns the source; the analyzer compiles it and sends the result to the GUI. Cmd+Backslash switches focus between Neovim and the GUI's canvas.

The GUI opens on a start screen that lists your library's cells. Click top to open it.

You can also open a cell from the keyboard. Press O in the GUI, and the command line opens with :Argon openCell filled in. Type an invocation such as top() and press Enter.

Replace the starter cell​

Replace the contents of lib.ar with:

lib.ar
cell inset_rect() {
}

Press O again and open inset_rect(). You don't need to save first: the analyzer compiles the buffer as you type, and the canvas updates a moment after you stop.

Draw two rectangles​

  1. Pick the met2 layer in the layer sidebar.
  2. Press R and click two opposite corners.
  3. Pick met1 and draw a larger rectangle around the first.
  4. Press Esc to return to selection mode.

Look at lib.ar in Neovim: each rectangle is now a std::layout::rect call, written with its full path so the file needs no import. The GUI writes into the buffer, not the file, so these edits can be undone like any other. The calls use initial values such as x0i and y1i, which is what lets you drag unconstrained edges later.

tip

Press U in the GUI to undo its last edit and Ctrl+R to redo it. F fits the layout to the canvas.

Check the project​

Save lib.ar, then run:

arc fmt
arc check

Next, add constraints to replace the sketched positions with relationships.