mirror of
https://github.com/prdlk/dotfiles.git
synced 2026-11-02 11:32:42 +00:00
Reverts43dfe48,0692ae3,e0cdcd6and the cable-description half of098da70(the star-prompt stats stay). master returns to the pre-iris shell setup: atuin in fish/zsh/bash, the down -> pj binding with PJ_QUIET, and the fish/zsh key bindings as they were. The iris work lives on the `iris` branch.
145 lines
7.5 KiB
Plaintext
145 lines
7.5 KiB
Plaintext
---
|
|
title: atuin
|
|
description: Shell history search with a daemon, directory-scoped up-arrow, tmux popups, a cyberdream theme, and the atuin AI inline command generator.
|
|
---
|
|
|
|
[atuin](https://atuin.sh) replaces shell history search in fish, bash, and zsh. It also provides `atuin ai inline`, a natural-language command generator that the fish config binds to keys.
|
|
|
|
| Source (repo) | Target | Notes |
|
|
| --- | --- | --- |
|
|
| `dot_config/atuin/private_config.toml` | `~/.config/atuin/config.toml` | `private_`: written as a regular `0600` file, not a symlink |
|
|
| `dot_config/atuin/themes/cyberdream.toml` | `~/.config/atuin/themes/cyberdream.toml` | symlink |
|
|
| `dot_config/atuin/atuin-receipt.json` | `~/.config/atuin/atuin-receipt.json` | symlink |
|
|
|
|
chezmoi runs in symlink mode, but `private_` files are written as real files, so edits to `~/.config/atuin/config.toml` do not reach the repo on their own. Copy them back with `chezmoi re-add` (or `czs`, see [fish](/shell/fish#functions)). None of the files are templates, and they apply on every role.
|
|
|
|
## Installation
|
|
|
|
`atuin` is listed in `.chezmoidata/packages.yaml` for pacman and Homebrew. The shells also expect atuin's standalone installer layout in `~/.atuin/bin`:
|
|
|
|
- fish: `conf.d/atuin.env.fish` sources `~/.atuin/bin/env.fish`.
|
|
- bash and zsh: `. "$HOME/.atuin/bin/env"` just before `atuin init`.
|
|
|
|
Neither line checks that the file exists, so a machine without `~/.atuin/bin` prints a sourcing error at shell start.
|
|
|
|
### atuin-receipt.json
|
|
|
|
The receipt that atuin's [cargo-dist](https://opensource.axo.dev/cargo-dist/) installer writes. It records how atuin was installed, which the self-updater (`atuin update`) needs:
|
|
|
|
| Field | Value |
|
|
| --- | --- |
|
|
| `binaries` | `["atuin"]` |
|
|
| `install_prefix` | `~/.atuin/bin` (stored as an absolute path under `/home/prad`) |
|
|
| `install_layout` | `flat` |
|
|
| `modify_path` | `true` |
|
|
| `provider` | cargo-dist `0.31.0` |
|
|
| `source` | GitHub release `atuinsh/atuin` |
|
|
| `version` | `18.19.0` |
|
|
|
|
## Shell integration
|
|
|
|
| Shell | Where | What |
|
|
| --- | --- | --- |
|
|
| fish | `config.fish`, interactive only | `atuin init fish \| source`, `atuin ai init fish \| source`, and the `?` binding |
|
|
| fish | `functions/fish_user_key_bindings.fish` | <kbd>ctrl-w</kbd> runs `atuin ai inline` |
|
|
| bash | end of `~/.bashrc` | `eval "$(atuin init bash)"` |
|
|
| zsh | end of `~/.zshrc` | `eval "$(atuin init zsh)"` |
|
|
|
|
In fish, `40-tools.fish` sources hishtory before atuin, but atuin's init runs later in `config.fish` and takes <kbd>ctrl-r</kbd>. zsh also loads `suv init zsh` (suvadu) if installed.
|
|
|
|
### Key bindings
|
|
|
|
| Key | Shells | Action |
|
|
| --- | --- | --- |
|
|
| <kbd>ctrl-r</kbd> | all | Interactive search (`_atuin_search`) |
|
|
| <kbd>up</kbd> | all | Search opened from the up arrow. `filter_mode_shell_up_key_binding = "directory"` limits it to history from the current directory |
|
|
| <kbd>?</kbd> | fish, vi normal mode | On an empty buffer, runs `atuin ai inline --hook` |
|
|
| <kbd>ctrl-w</kbd> | fish, insert and normal mode | `atuin ai inline`, then repaint |
|
|
| <kbd>ctrl+shift+p</kbd> | kitty | [`atuin-pick`](/shell/scripts#atuin-pick): directory-filtered search in a split, running the pick in a fresh fish |
|
|
|
|
Under tmux, atuin's `[tmux]` settings open the search in a tmux popup (80% wide, 60% tall) instead of inline.
|
|
|
|
## AI inline
|
|
|
|
Commit `a82921c` ("add Atuin AI inline integration and keybinding") added the <kbd>ctrl-w</kbd> bind to `fish_user_key_bindings.fish` and the following to `config.fish`:
|
|
|
|
1. `atuin ai init fish | source`, in the interactive block next to `atuin init fish`.
|
|
2. A copy of the `_atuin_ai_question_mark` function that `atuin ai init fish` prints, and `bind "?" _atuin_ai_question_mark`.
|
|
|
|
The config also sets `[ai] enabled = true`.
|
|
|
|
`_atuin_ai_question_mark` works like this:
|
|
|
|
- **Buffer empty (or just `?`):** clears the line, prints OSC `133;C` to `/dev/tty` to close the terminal's semantic prompt zone (so shell-integrated terminals do not erase the TUI during a prompt reflow), then runs `atuin ai inline --hook` with stdout and stderr swapped. The TUI draws on the terminal, and the result comes back tagged:
|
|
|
|
| Output prefix | Effect |
|
|
| --- | --- |
|
|
| `__atuin_ai_print__:` | Print the text, repaint |
|
|
| `__atuin_ai_cancel__` | Repaint only |
|
|
| `__atuin_ai_execute__:` | Put the command on the line and execute it |
|
|
| `__atuin_ai_insert__:` | Put the command on the line for editing |
|
|
| anything else, non-empty | Put it on the line for editing |
|
|
|
|
- **Buffer not empty:** inserts a literal `?` under emacs bindings. Under vi or hybrid bindings, which this config uses, it does nothing.
|
|
|
|
`bind "?"` in `config.fish` has no `-M` flag, so it applies to fish's `default` mode, which is vi **normal** mode here. In insert mode <kbd>?</kbd> types a question mark. To ask for a command, press <kbd>Esc</kbd> and then <kbd>?</kbd> on an empty line, or press <kbd>ctrl-w</kbd> from either mode. The <kbd>ctrl-w</kbd> bind calls `atuin ai inline` without `--hook` and replaces fish's default <kbd>ctrl-w</kbd> word deletion.
|
|
|
|
bash and zsh do not load `atuin ai init`.
|
|
|
|
## Configuration
|
|
|
|
`config.toml` is atuin's generated sample with a few keys set. The rest are commented-out defaults. The settings that take effect:
|
|
|
|
| Key | Value | Effect |
|
|
| --- | --- | --- |
|
|
| `filter_mode_shell_up_key_binding` | `"directory"` | Up-arrow search shows only the current directory's history |
|
|
| `dotfiles.enabled` | `true` | Enables atuin's dotfiles feature (aliases and vars managed by atuin) |
|
|
| `daemon.enabled` | `true` | Uses the background daemon |
|
|
| `daemon.autostart` | `true` | atuin starts and manages the daemon itself |
|
|
| `pty_proxy.enabled` | `false` | `atuin init` does not re-exec the shell inside `atuin pty-proxy` |
|
|
| `theme.name` | `"cyberdream"` | Loads `themes/cyberdream.toml` |
|
|
| `tmux.enabled` | `true` | Search opens in a tmux popup when inside tmux (tmux 3.2+) |
|
|
| `tmux.width` / `tmux.height` | `"80%"` / `"60%"` | Popup size |
|
|
| `ai.enabled` | `true` | Enables `atuin ai` |
|
|
|
|
No sync server, key, or session is configured in the repo. atuin keeps its encryption key and session under `~/.local/share/atuin`, outside chezmoi, and uses the default sync server.
|
|
|
|
:::warning[Misplaced keys]
|
|
Several keys sit after the `[dotfiles]` table header, so TOML puts them inside `[dotfiles]` rather than at the top level, and atuin ignores them. `atuin config get --resolved` confirms it:
|
|
|
|
| Key as written | Intended | Resolved |
|
|
| --- | --- | --- |
|
|
| `search_mode` | `"daemon-fuzzy"` | `fuzzy` |
|
|
| `enter_accept` | `true` | `false` |
|
|
| `workspaces` | `true` | `false` |
|
|
| `style` | `"auto"` | `compact` |
|
|
| `inline_height_shell_up_key_binding` | `20` | unknown key |
|
|
| `auto_sync` | `true` | `true` (the default) |
|
|
| `update_check` | `true` | `true` (the default) |
|
|
|
|
`syntax_highlight = true` has the same problem: it sits under `[ai]`, while the comment block above it documents the `[ui]` table.
|
|
|
|
To apply these settings, move the keys above `[dotfiles]` (and `syntax_highlight` under `[ui]`) in `dot_config/atuin/private_config.toml`.
|
|
:::
|
|
|
|
## Theme
|
|
|
|
`themes/cyberdream.toml` defines a theme named `cyberdream`, using the palette shared with [fish](/shell/fish#theme) and [Starship](/shell/starship#palette):
|
|
|
|
| Key | Color |
|
|
| --- | --- |
|
|
| `AlertInfo` | `#5ef1ff` |
|
|
| `AlertWarn` | `#f1ff5e` |
|
|
| `AlertError` | `#ff6e5e` |
|
|
| `Annotation` | `#7b8496` |
|
|
| `Guidance` | `#5ea1ff` |
|
|
| `Important` | `#ff5ef1` |
|
|
| `Title` | `#5ef1ff` |
|
|
| `Muted` | `#7b8496` |
|
|
| `SyntaxCommand` | `#5ea1ff` |
|
|
| `SyntaxFlag` | `#5ef1ff` |
|
|
| `SyntaxString` | `#5eff6c` |
|
|
| `SyntaxVariable` | `#ff5ef1` |
|
|
| `SyntaxOperator` | `#ff5ea0` |
|
|
| `SyntaxComment` | `#7b8496` |
|