# LLeMbas IDE
A complete Neovim editor with LLeMbas built in, installed by one script.
It is stock Neovim, a pinned release, with a ready configuration: four bars around the code (what
LLeMbas is doing at the top, the keys for where you are at the bottom, the file tree on the left,
LLeMbas's settings, chat and prompt on the right), a fuzzy finder, Treesitter highlighting,
language servers, a completion menu, git signs and diffs, key hints, a terminal, sessions, and
the LLeMbas plugin for chat, asking about code, rewriting and suggestions as you type. It keeps to itself: its own
`NVIM_APPNAME`, its own directories. A Neovim configuration of your own in `~/.config/nvim` is
never read and never written.
It works fully as an editor on its own. LLeMbas needs two more things: the
[LLeMbas CLI](https://github.com/LLeMbas/LLeMbas-CLI), which the installer offers, and a sign-in
to your LLeMbas server (`lembas login
`). No server, model or key is set anywhere in
the IDE.
## Install
```sh
curl -fsSL https://github.com/LLeMbas/LLeMbas-IDE/releases/latest/download/install.sh | bash
```
While LLeMbas IDE is in beta there is no stable release for that to find; take a beta's own
installer and ask for the betas (`` from the
[releases page](https://github.com/LLeMbas/LLeMbas-IDE/releases)):
```sh
curl -fsSL https://github.com/LLeMbas/LLeMbas-IDE/releases/download/v/install.sh | bash -s -- --channel beta
```
From a clone of this repository: `ide/install.sh --from-checkout`.
Then start it with `llembas-ide` (any arguments go to Neovim: `llembas-ide src/main.c`).
Linux on x86-64 and arm64. macOS is written for and has not been tried. It needs `bash`, `git`,
`curl`, `tar`, `sha256sum` and `ssh-keygen` (the `openssh-client` package: it checks the
release's signature); nothing runs as root. `curl … | bash -s -- --help` prints every option. Good to have: a C compiler (`cc`) for the
Treesitter grammars, `rg` (ripgrep) for searching in files, a Nerd Font is not needed.
| Option | What it does |
|---|---|
| `--version X` | install release X instead of the newest |
| `--channel stable\|beta` | which releases "newest" looks at (default `stable`) |
| `--prefix DIR` | where the IDE itself goes (default `~/.local/share/llembas-ide`) |
| `--from-checkout` | install from the clone the script sits in |
| `--nvim-bin PATH` | use a Neovim of your own (0.10 or newer) instead of the pinned release |
| `--no-cli` | do not offer the LLeMbas CLI |
| `--no-parsers` | do not compile the Treesitter grammars |
| `--yes` | ask nothing |
| `--dry-run` | print every action and do nothing |
### What gets installed, and where
| Where | What |
|---|---|
| `~/.local/share/llembas-ide/nvim/` | Neovim, the release pinned in [`neovim.version`](neovim.version); its SHA-256 is checked against [`neovim.sha256`](neovim.sha256) before it is unpacked |
| `~/.local/share/llembas-ide/site/pack/llembas/` | the IDE's configuration, the third-party plugins, the compiled Treesitter grammars |
| `~/.local/share/llembas-ide/lib/` | the LLeMbas plugin, the installer and the lock files (for `update`, `doctor` and `uninstall`) |
| `~/.config/llembas-ide/init.lua` | starts the IDE; replaced by an update unless you edited it |
| `~/.config/llembas-ide/lua/user/init.lua` | **yours**: created once with comments only, never overwritten |
| `~/.local/bin/llembas-ide` | the launcher |
| `~/.local/share/applications/llembas-ide.desktop`, `~/.local/share/icons/hicolor/256x256/apps/llembas-ide.png` | the menu entry (Linux) |
Neovim keeps the IDE's history, undo files and sessions in `~/.local/state/llembas-ide/` and its
cache in `~/.cache/llembas-ide/`. Nothing else is written. `XDG_DATA_HOME`, `XDG_CONFIG_HOME`,
`XDG_STATE_HOME` and `XDG_CACHE_HOME` are honoured.
Everything is built in a staging directory and started there once, headless, before it replaces
what is installed. A failure at any point leaves the previous installation, or nothing, exactly
as it was.
### What it is made of
The third-party plugins are five, each fetched with git at exactly the commit in
[`plugins.lock`](plugins.lock) (the commit hash is the check), and the Treesitter grammars are
compiled from the commits in [`parsers.lock`](parsers.lock). Names, sources, licences and pins:
[`THIRD_PARTY.md`](THIRD_PARTY.md). All of it is MIT or Apache-2.0.
There is no plugin manager. The plugins are plain Neovim packages (`:help packages`) that the
installer places; the editor only loads what is there. So nothing is installed, fetched or
updated when the IDE starts or while it runs, no plugin ever moves off its pinned commit on its
own, and the IDE starts the same with or without a network. Plugins change when LLeMbas IDE
does: a new version of the IDE carries new pins.
- **Treesitter.** With a C compiler at install, 19 grammars are compiled (Bash, C, CSS, Go, HTML,
JavaScript, JSON, Lua, Markdown, Python, Rust, TOML, TSX, TypeScript, Vimscript, help, YAML and
two helpers). Without one, Neovim's own bundled grammars colour C, Lua, Markdown, Vimscript and
help, and every other language uses Neovim's regular syntax files; install a compiler and run
`llembas-ide update` to get them all.
- **Language servers.** Neovim's built-in client starts the servers it finds on your `PATH`
(`:LLeMbasIdeLsp` lists the ones the IDE knows, which are found, and how each project says to
install its server). The IDE never downloads a language server or a formatter: there is no
installer for third-party programs in it.
- **Formatting** happens when you ask (`cf`), with a formatter that is installed, or the
language server.
## The screen
```
┌──────────────────────────────────────────────────────────────────────┐
│ ● idle │ fix config loader │ flash · manual · high │ ctx 12% │ AC on │ top bar
├────────────┬──────────────────────────────────┬──────────────────────┤
│ ▾ src/ │ 1 fn main() { │ model flash │ the settings, live:
│ ▸ api/ │ 2 let cfg = Config::load() │ mode manual │ Enter on a line opens
│ main.rs│ 3 run(cfg) │ effort high │ its choices right there
│ lib.rs │ 4 } │ autocomplete on │
│ ▸ tests/ │ 5 ├──────────────────────┤
│ Cargo.to…│ 6 fn run(cfg: Config) { │ ## You │ the chat
│ README.md│ 7 ... │ why does load … │
│ │ ├──────────────────────┤
│ │ │ main.rs:2-3 │ what comes along
│ │ │ ask › _ │ the prompt
├────────────┴──────────────────────────────────┴──────────────────────┤
│ ^⇧A ask · Tab accept suggestion · ^⇧P menu · Alt+←→ bars NOR 3:9 │ bottom bar
└──────────────────────────────────────────────────────────────────────┘
```
- **Top bar.** What LLeMbas is doing (idle, thinking, tools, writing, waiting for you, not signed
in, no CLI, AI off), the conversation's title, model · mode · effort, how full the model's
context is, suggestions on or off, and at the right end the git branch and the file's problems
when there is room. Every cell has a fixed width; the title takes what is left and is cut with
an ellipsis.
- **Bottom bar.** The keys you need most *where the focus is*: it changes as you move between the
code, the tree, the prompt, the settings lines, the transcript, and a proposed change. It is
made from the same table that maps the keys, so it cannot show a key that is not bound, and it
is cut from the end to fit, never wrapped. At its right end is Neovim's own state: the mode,
`+` for unsaved changes, the macro being recorded, the line and column, and from 120 columns
the search count and the pending operator (narrower, those two are where stock Neovim shows
them, in the command line's row under the bar).
- **The tree** (left). Open by default, 26 columns. The file you are in is followed and marked.
`Enter` opens a file and opens or closes a directory (`→`/`←` too), `a` makes a file — or a
directory when the name ends in `/` — `r` renames or moves, `d` deletes after asking (into the
trash where the system has one), `/` filters as you type, `.` shows hidden files. One mark per
row says its git state (`M` changed, `A` added, `?` new, `D` deleted, `!` conflict, `•` a
directory with changes inside).
- **The right bar.** At the top the settings as they are now; move there and press `Enter` on a
line to open its choices under it, `Enter` again to take one. Under them the conversation, and
at the bottom the prompt. The prompt's first line begins with what `Enter` will do: `ask ›`,
`rewrite ›` or `add ›`.
**From the code to LLeMbas.** `Ctrl+Shift+A` (or `la`) goes to the prompt and takes along
what you are on: the selection, or else the cursor's line. Its name is shown above the prompt
(`main.rs:12-18`). In an empty prompt `Tab` switches what `Enter` does with it:
| The prompt says | Enter |
|---|---|
| `ask ›` | sends the question to the chat, with what came along as context |
| `rewrite ›` | has those lines rewritten; the result is shown in the file as changes to accept or reject |
| `add ›` | has new code written at that point, shown the same way |
Nothing is written into a file until you accept it (`Ctrl+Shift+Y`, or `ga`; `Ctrl+Shift+J` or
`gr` rejects). With text in the prompt `Tab` is Neovim's own Tab. `Enter` sends, `Ctrl+J` makes a
new line, `Esc` goes back to the code.
**Narrow and low screens.** When the code would be left with fewer than 60 columns the right bar
folds away, then the tree; `Ctrl+Shift+D` and `Ctrl+Shift+E` (or `Alt+→` / `Alt+←`) bring them
back at any width. The top and bottom bars drop their least needed cells. Under 18 rows the
settings lines make room for the chat.
**What is remembered.** The mode, the effort, suggestions on or off, LLeMbas on or off, which
bars are shown and how wide the side bars are: per working directory, in
`~/.local/state/llembas-ide/llembas/settings.json`. A directory that has chosen nothing takes
the machine-wide values, which *Make these settings the default for every directory* in the menu
(`Ctrl+Shift+P`) sets from where you are. The models are not kept here: the LLeMbas CLI remembers
the model last used in a directory, and your account the autocomplete model.
## Keys
The leader key is ``. Press it and wait: the next keys are shown. `:LLeMbasIdeKeys` (or
`ik`) shows this list in the editor.
**LLeMbas's keys have two forms.** The chords — `Ctrl+Shift+A` and the rest, the same as in the
LLeMbas terminal — reach Neovim only from a terminal that reports such keys distinctly (the kitty
keyboard protocol: kitty, Ghostty, foot, WezTerm with it switched on, and the LLeMbas terminal,
which hands its own chords through while the IDE is in front). The other form, a key after
`l`, arrives everywhere. Both are always mapped. The bottom bar shows the chords once one
has arrived from your terminal (that is remembered) or the terminal is one known to report them,
and the `` keys otherwise; `keys = { chords = true }` or `false` in your own file settles
it by hand.
The completion menu and LLeMbas's suggestions share insert mode and never want the same key:
`` accepts LLeMbas's grey suggestion when one is shown and is a plain Tab otherwise; the menu
is moved in with ``/`` and taken with `` (the entry you moved to) or `` (the
first one). In an empty prompt `` switches ask, rewrite, add; no menu opens over the prompt.
**Typing**
| Keys | In | What it does |
|---|---|---|
| `` | insert | Ask LLeMbas for a suggestion now (accepting one: under LLeMbas, below) |
| ` ` | insert | Move in the completion menu (also ) |
| `` | insert | Take the menu entry you moved to; otherwise a new line |
| `` | insert | Take the menu's first entry |
| `` | insert | Close the menu |
| `` | insert | Open the menu, or the entry's documentation |
**Editing**
| Keys | In | What it does |
|---|---|---|
| `gcc` | normal | Comment the line, on and off (gc with a motion or a selection) |
| `sa sd sr` | normal | Surround: add (saiw"), delete (sd"), replace (sr"') |
| `K` | normal | Documentation of the symbol under the cursor |
| `gd gD gI gy` | normal | Definition, declaration, implementation, type (with a language server) |
**Find**
| Keys | In | What it does |
|---|---|---|
| `` | normal | Find a file |
| `/` | normal | Search in files (needs rg) |
| `,` | normal | Switch buffer |
| `e` | normal | File tree (the left bar), show and hide |
| `E` | normal | Directories side by side, at this file (edit them like text) |
| `ff` | normal | Find a file |
| `fg` | normal | Search in files (needs rg) |
| `fw` | normal | Search the word under the cursor |
| `fb` | normal | Open buffers |
| `fr` | normal | Recent files |
| `fs` | normal | Symbols in this file |
| `fS` | normal | Symbols in the project |
| `fR` | normal | References to the symbol under the cursor |
| `fd` | normal | Problems in the project |
| `fh` | normal | Help pages |
| `fk` | normal | All key mappings |
| `f.` | normal | The last search again |
**Buffers**
| Keys | In | What it does |
|---|---|---|
| `bd` | normal | Close the buffer, keep the window |
| `bn` | normal | Next buffer |
| `bp` | normal | Previous buffer |
| `` | normal | Next buffer |
| `` | normal | Previous buffer |
| `w` | normal | Save |
| `q` | normal | Close the window |
| `` | normal | Clear the search highlight |
**Code**
| Keys | In | What it does |
|---|---|---|
| `ca` | normal | Code action |
| `cr` | normal | Rename the symbol |
| `cf` | normal, visual | Format the file or the selection |
| `cd` | normal | The problem on this line |
| `cl` | normal | Language servers: found, missing, how to install |
**Problems**
| Keys | In | What it does |
|---|---|---|
| `xx` | normal | Problems in this file, as a list |
| `xw` | normal | Problems in the project, as a list |
| `xn` | normal | Next problem |
| `xp` | normal | Previous problem |
**Git**
| Keys | In | What it does |
|---|---|---|
| `gs` | normal | Changed files |
| `gh` | normal | Changes, hunk by hunk |
| `gd` | normal | This file beside its committed version |
| `go` | normal | Show changes inline, on and off |
| `ga` | normal | Stage the change under the cursor |
| `gr` | normal | Undo the change under the cursor |
| `gb` | normal | Who changed this line, and the commit |
| `]g [g` | normal | Next and previous git change (]G [G: last and first) |
**LLeMbas**
| Keys | In | What it does |
|---|---|---|
| ` or la` | normal, visual; the chord also in insert | To the chat prompt; the selection, or else the cursor's line, comes along |
| `le` | normal, visual | To the prompt, to have the selection or the line rewritten (shown as changes) |
| `lg` | normal, visual | To the prompt, to have new code written at the cursor (shown as changes) |
| `lx` | normal, visual | Explain the line or the selection |
| `lf` | normal | Fix this file's problems |
| `` | insert, with a suggestion | Accept the suggestion (the grey text); without one, Neovim's own Tab |
| `` | insert, with a suggestion | Accept one word of the suggestion |
| ` or lt` | normal; the chord also in visual, insert | Suggestions as you type, on and off |
| ` or lC` | normal; the chord also in visual, insert | Choose the model that writes suggestions |
| ` or lp` | normal; the chord also in visual, insert | The LLeMbas menu: every command and every setting |
| ` or lm` | normal; the chord also in visual, insert | Switch the mode |
| ` or lM` | normal; the chord also in visual, insert | Choose the model |
| `lE` | normal | Choose the effort |
| ` or lI` | normal; the chord also in visual, insert | LLeMbas on and off (off: a plain editor, nothing is sent) |
| ` or l.` | normal; the chord also in visual, insert | Stop the running turn |
| ` or ga` | a proposed change | Accept the proposed change under the cursor |
| ` or gr` | a proposed change | Reject the proposed change under the cursor |
| `]h` | a proposed change | The next proposed change |
| `[h` | a proposed change | The previous proposed change |
| ` or gA` | a proposed change | Accept every proposed change in the file |
| `gR` | a proposed change | Reject every proposed change in the file |
| ` or lb` | normal; the chord also in visual, insert | The file tree, show and hide |
| ` or ll` | normal; the chord also in visual, insert | The chat (the right bar), show and hide |
| `` | normal, insert | To the bar on the left: chat, code, tree |
| `` | normal, insert | To the bar on the right: tree, code, chat |
| `ls` | normal | Earlier conversations |
| `ln` | normal | New conversation |
| `lc` | normal | Commands and skills |
| `lS` | normal | Status |
| `li` | normal | Sign in |
| `l?` | normal | The plugin's commands and keys |
| ` l` | the tree | Open the file; open or close the directory (→ opens, ← closes) |
| ` h` | the tree | Close the directory, or go to the one above |
| `a` | the tree | New file, or directory with a / at the end |
| `r` | the tree | Rename or move |
| `d` | the tree | Delete, after asking (to the trash where there is one) |
| `/` | the tree | Filter by name as you type (empty: everything again) |
| `.` | the tree | Hidden files, show and hide |
| `R` | the tree | Read the directory again |
| `` | the settings lines | Open the line's choices, or take the one under the cursor |
| ` ` | the settings lines | Move between the lines and the choices |
| `` | the settings lines | Close the choices; from the lines, back to the code |
| `` | the prompt | Send (while a turn runs: steer it) |
| `` | the prompt | In an empty prompt: what Enter will do — ask, rewrite, add |
| `` | the prompt | A new line in the prompt |
| `` | the prompt | Back to the code |
| `` | the transcript | Open the file:line under the cursor |
| `K` | the transcript | What the tool on this line printed |
| `i` | the transcript | To the prompt |
**Session**
| Keys | In | What it does |
|---|---|---|
| `sr` | normal | Restore this directory's session |
| `sw` | normal | Save the session now |
| `sd` | normal | Forget this directory's session |
**Terminal**
| Keys | In | What it does |
|---|---|---|
| `tt` | normal | Terminal, open and close |
| `` | normal, terminal | Terminal, open and close |
| `` | normal, terminal | The same, as some terminals send it |
| `` | terminal | Leave the terminal's typing mode |
**Look**
| Keys | In | What it does |
|---|---|---|
| `ut` | normal | Dark and light theme |
| `uw` | normal | Wrap long lines, on and off |
| `un` | normal | Relative line numbers, on and off |
**IDE**
| Keys | In | What it does |
|---|---|---|
| `ih` | normal | Start screen |
| `ik` | normal | This list of keys |
| `id` | normal | Check the installation |
| `iu` | normal | Open your own settings file |
| `iv` | normal | Versions |
`` and `` replace Neovim's "top and bottom of the window" motions, `s` belongs to
surround, and `` in normal mode also clears the search highlight. `` and ``
move between the bars. Everything else of Neovim's is as it was.
The open buffers have no line of their own while the top bar is shown: `,` lists them,
`` and `` go through them, and the tree marks the one you are in.
## Make it yours
`~/.config/llembas-ide/lua/user/init.lua` (open it with `iu`) is loaded last, so what it
sets wins: options, keys, the theme (`vim.o.background = "light"`, or another colourscheme
altogether), the LLeMbas plugin's settings (`require("llembas").setup({ … })`, see
`:help llembas-setup`), more language servers (`vim.lsp.enable("name")`).
**The bars** are one table. Each can be switched off and the side bars have widths:
```lua
require("llembas").setup({ bars = {
top = true, bottom = true, -- off: the IDE's line of open buffers / its statusline instead
tree = true, chat = true, -- whether the side bars are open when a directory is new to you
tree_width = 26, chat_width = 42,
min_code = 60, -- the side bars fold away below this many columns of code
} })
require("llembas").setup({ bars = false }) -- none of it: one window and the plain chat panel
```
What you then switch by key in a directory is remembered for that directory and holds over the
table; the menu's *Forget what this directory chose for itself* takes it back.
**LLeMbas's keys** are one table too (`:help llembas-keys`). Change an entry and map again, and
the bottom bar, the menu and this list follow:
```lua
local keys = require("llembas.keys")
keys.by_id.ask.chord = "" -- instead of Ctrl+Shift+A
keys.by_id.tree.alt = "t" -- instead of lb
require("llembas").setup({ keys = { prefix = "l" } })
```
Any other key is Neovim's own to map (`vim.keymap.set`), and what you map there wins.
Your own plugins go in `~/.config/llembas-ide/pack/user/start//`: clone each there
yourself and set it up in your file. The IDE loads them and never installs or updates them.
The colourscheme `llembas` has two halves from LLeMbas's two themes: `moria` (dark, the default)
and `shire` (light). `ut` switches.
## Update, check, remove
```sh
llembas-ide update # the newest release over this one; your settings are kept
llembas-ide doctor # what is installed, what is missing, what is off without it
llembas-ide --version # the IDE, Neovim and the LLeMbas plugin
llembas-ide uninstall # remove it; --purge also removes your settings
```
`update` runs the installed installer: it finds the newest release of the channel you are on (a
beta stays with the betas), downloads it, checks it against the release's `SHA256SUMS` — which must be signed with the LLeMbas release key, the one the LLeMbas CLI's installer checks — and runs
the installer inside it. Running `install.sh` again does the same. Plugins that did not change
are kept as they are, so an update only fetches what is new.
`uninstall` removes what the installer placed and the IDE's history and cache. It keeps your
settings unless you say otherwise, and touches nothing else.
## Privacy: what leaves the machine, and when
- **Installing and updating** download Neovim and the plugins from GitHub, and the release from
this repository. That is all the network the IDE itself ever uses.
- **Running the editor sends nothing.** No telemetry, no update check, nothing loaded from a
network at start or later. Opening, editing, searching and completing are local.
- **LLeMbas features** talk to the LLeMbas CLI on your machine, which talks to the LLeMbas server
you signed in to, and to nothing else. That begins when you use one: open the chat, ask,
rewrite, or type with suggestions on. Suggestions as you type are on once the CLI is
installed; `lt` turns them off, and `complete = { auto = false }` in your settings
keeps them off.
- **What a suggestion sends** to your server: the text around the cursor, and pieces of up to
six other files you have open. **What a message sends** besides what you typed: the name of
the file you are in, the cursor's line, the lines that came along, and the names of the other
open files. Other files go along — by name or by text — only when they are **inside the
working directory**, and never when they **look like they hold secrets** (`.env`, keys and
certificate stores, `credentials*`, `secrets.*`, anything under `.ssh/`, `.gnupg/`, `.aws/`,
`.kube/`; the whole list is in `:help llembas-privacy`) or when the project's **`.gitignore`**
leaves them out. In a file that looks like it holds secrets no suggestion is asked for at
all. The agent itself reads files as a turn needs them, under the CLI's permissions.
- **The LLeMbas CLI**, when you let the installer install it, comes from its own release: its
installer is run only once it matches that release's signed checksums.
- **A language server** you installed runs locally; what it does on the network is its own.
- **LLeMbas off** (`Ctrl+Shift+I`, `lI`) makes it a plain editor: the agent is stopped, no
suggestion is asked for, the chat is put away, and it stays so in that directory until you
switch it on.
- **Inside the LLeMbas terminal** (`$LLEMBAS_TERM` or `$LLEMBAS_TTY` set) the IDE tells the
terminal that it is in front, by a user var (`llembas_ide=1`, cleared on the way out), so the
terminal passes its chords on. That goes to the terminal and no further; in any other terminal
nothing is written.
What a model writes is shown as text and never run. Modelines and per-directory configuration
files (`exrc`) are off, and a `Session.vim` lying in a project is not read.
## For developers
`scripts/test-ide.sh` checks all of this: the scripts with shellcheck, a dry run, real installs
into a temporary home (with the pinned Neovim and with the oldest supported one), a headless
start with the checks in [`tests/headless.lua`](tests/headless.lua), updating in place, and
uninstalling. `scripts/gen-ide-theme.py` writes the colourscheme from the design tokens
([`tokens.css`](tokens.css)); `scripts/package-ide.sh` writes the release files into `dist/`.
The oldest Neovim the IDE runs on is 0.10. The one it installs is the pinned release.