hausfold

haus

Text expansion

Type a short trigger, get the long thing, in any app, terminals and Electron included, from a table you keep in your host file.

Type @@ and get your email address. Type ;addr and get your postal address. The Text expansion room wires up espanso and keeps the table of snippets in the same file as the rest of your machine.

It works where macOS's own text replacement doesn't (terminals and many Electron apps), because espanso injects keystrokes rather than relying on the system text engine.

Enable it

haus.snippets.enable = true;
haus rebuild

Configure it

The table is a list of triggerreplace pairs:

haus.snippets = {
  enable = true;
  matches = [
    { trigger = "@@"; replace = "ada@example.com"; }
    { trigger = ";sig"; replace = "— Ada"; }
    { trigger = ";shrug"; replace = "¯\\_(ツ)_/¯"; }
  ];
};

They're written to ~/.config/espanso/match/default.yml. Only the plain trigger→replace form is exposed here; for dynamic matches (dates, shell output, forms), drop a hand-written .yml beside it in ~/.config/espanso/match/. espanso loads every file in that directory, so the two live together happily.

Your table replaces the desktop's, it doesn't extend it

matches is one value, not an accumulator: naming it in your host discards whatever the desktop set rather than appending to it. If you want the desktop's snippets plus your own, restate both, or put yours in a hand-written .yml beside the generated one, where nothing overwrites anything.

Works with

Nothing else in the house. Expansion happens in whichever app has focus, so the room has no bar pill, no palette command and no keybinding of its own.

Permissions and side effects

espanso needs a one-time macOS Accessibility grant: System Settings ▸ Privacy & Security ▸ Accessibility ▸ enable Espanso. Until you give it, nothing expands.

haus installs the signed Espanso.app cask and runs that, rather than a nix-store binary, on purpose: the grant is keyed to a stable identity, so it survives reboots and nixpkgs bumps. You grant it once, not on every rebuild, and espanso's own "something is wrong" window stops appearing at login, since that window only ever meant the grant went missing.

Remove it

haus.snippets.enable = false;

The cask is no longer declared and the generated match file stops being written. Revoke the Accessibility grant yourself if you want it gone, and remove any hand-written .yml files you added; haus never wrote those, so it doesn't take them away.

Options

Every setting, with types and defaults: haus.snippets.

On this page