init
atuin init <shell>
Prints the shell plugin for the given shell. Evaluating its output is what installs Atuin's hooks and key bindings into your session, so this command belongs in your shell's startup file rather than being run by hand.
See installation for the exact line to add for your shell — the syntax differs between shells.
Supported shells: zsh, bash, fish, nu, xonsh, powershell. See Supported platforms for what each tier means.
What it sets up
- Hooks that record each command, its exit code, and its duration. See Shell Integration.
- Key bindings for Ctrl+R and the Up arrow, and ? for Atuin AI.
- Widgets for
atuin ai resume(zsh, bash and fish), unbound unless you ask for them: see Bindingatuin ai resume.
Flags
| Flag | Description |
|---|---|
--disable-up-arrow | Don't bind the Up arrow key |
--disable-ctrl-r | Don't bind Ctrl+R |
--disable-ai | Don't bind ? to Atuin AI |
--bind-ai-resume | Bind Ctrl+] to atuin ai resume (zsh, bash and fish; off by default) |
For example, to keep Ctrl+R but leave the up arrow alone:
Binding atuin ai resume
atuin init defines widgets that open the atuin ai resume picker at the prompt and put the command it picks into your shell, but binds no key to them by default. To bind Ctrl+] in the emacs, vi-insert and vi-command keymaps, pass --bind-ai-resume:
Ctrl+] replaces a shell binding
Ctrl+] is zsh's vi-find-next-char (emacs keymap) and bash's character-search: jump to the next occurrence of the character you type next. --bind-ai-resume replaces it. To keep it, bind the widget to another key yourself.
To bind a key of your choice instead, add it after the atuin init line:
eval "$(atuin init bash)"
atuin-bind -m emacs '\C-x\C-r' atuin-ai-resume-emacs
atuin-bind -m vi-insert '\C-x\C-r' atuin-ai-resume-viins
atuin-bind -m vi-command '\C-x\C-r' atuin-ai-resume-vicmd
atuin-bind is the helper atuin init bash defines (see Key Binding); it also works under ble.sh.
Environment variables
| Variable | Effect |
|---|---|
ATUIN_NOBIND | If set to any value, binds no keys at all. Equivalent to passing every --disable-* flag. |
ATUIN_NO_BUILTIN_PREEXEC | Bash only. Stops atuin init bash from automatically loading its bundled bash-preexec (Atuin >= 18.18.0). |
Binding no keys is useful when you want to choose the bindings yourself:
See Key Binding for the widget and function names each shell exposes, and Advanced Key Binding for customizing the keys inside the TUI.