Atuin: Difference between revisions

Zebreus (talk | contribs)
Start writing some documentation about atuin in nixos
 
add note on disabling up-arrow / Ctrl+R
 
(7 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{note|This page is a WIP}}
{{wip|date=11 March 2025}}


[https://atuin.sh/ Atuin] replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, Atuin (optionally) syncs your shell history between all of your machines.
[https://atuin.sh/ Atuin] replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, Atuin (optionally) syncs your shell history between all of your machines.
Line 20: Line 20:
};
};
</nowiki>}}
</nowiki>}}
=== Disable up-arrow / Ctrl+R keybindings ===
Key bindings are not part of Atuin settings and need to be passed as flags instead.{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{ pkgs, ... }: {
  programs.atuin = {
    enable = true;
    # ...
    flags = [ "--disable-up-arrow" ]; # or --disable-ctrl-r
  };
};
</nowiki>|name=~/.config/home-manager/home.nix|lang=nix}}


=== Enable synchronization with atuin.sh ===
=== Enable synchronization with atuin.sh ===


==== Imperatively ====
==== Imperatively ====


To synchronize your history with atuin.sh you first need to register an account or login with the cli utility. Doint that will create a key and an session token in <code>~/.local/share/atuin</code>
To synchronize your history with atuin.sh you first need to register an account or login with the cli utility. Doing that will create a key and a session token in <code>~/.local/share/atuin</code>


<syntaxHighlight lang="bash">
<syntaxHighlight lang="bash">
Line 44: Line 53:
You can manage your atuin session declaratively by setting the <code>session_path</code> and <code>key_path</code> options to files containing a session token and a key. You can obtain these two files by registering as described above and copying them from <code>~/.local/share/key</code> and <code>~/.local/share/session</code>. The example below uses agenix
You can manage your atuin session declaratively by setting the <code>session_path</code> and <code>key_path</code> options to files containing a session token and a key. You can obtain these two files by registering as described above and copying them from <code>~/.local/share/key</code> and <code>~/.local/share/session</code>. The example below uses agenix


{{note|Both the session and key file must not have a trailing newline.}}
{{note|Both the session and key file must not have a trailing newline or you get <code>Error: failed to parse header value</code>. Several common editors (e.g. Vim) will automatically add a newline on save.}}


{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{{file|~/.config/home-manager/home.nix|nix|<nowiki>
Line 59: Line 68:
};
};
</nowiki>}}
</nowiki>}}
=== zsh autosuggestions ===
If zsh autosuggestions is enabled, atuin automatically adds itself as the first autosuggestion strategy; see [https://docs.atuin.sh/integrations/#zsh-autosuggestions atuin docs]
{{file|~/.config/home-manager/home.nix|nix|<nowiki>
{ pkgs, ... }: {
  programs.zsh = {
    enable = true;
    autosuggestion.enable = true; # Enable autosuggestions
  };
  programs.atuin = {
    enable = true;
  };
};
</nowiki>}}
[[Category:Server]]
[[Category:Shell]]