Files
dotfiles/dot_local/bin/executable_atuin-pick
T
Prad Nukala c3828a747c fix(atuin): use the packaged binary only
~/.atuin/bin held an old standalone atuin (18.19.0) that the shells
prepended to PATH, shadowing pacman's /usr/bin/atuin (18.21.0). The
daemon runs the packaged binary and migrated the history DB, so every
shell command through the old one failed with "migration 20260818000000
was previously applied but is missing in the resolved migrations".

Drop conf.d/atuin.env.fish, the `. ~/.atuin/bin/env` lines in .bashrc
and .zshrc (atuin init is now guarded on `command -v atuin`), the
cargo-dist receipt, and atuin-pick's ~/.atuin/bin fallback. Also drop
`atuin ai init fish`, which 18.21 removed; config.fish already carries
the `?` binding it emitted.
2026-10-05 11:00:15 -04:00

32 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""atuin-pick: atuin history picker for a kitty split (ctrl+shift+p).
atuin search -i draws its TUI on the tty and prints the selected command
to stdout (Esc prints nothing). Filter to history from the current
directory. Hand the selection to an interactive fish via --init-command:
it runs inside that shell (aliases/abbr resolve, cd persists) with its
output in the split, and the prompt drops down below it.
"""
import os
import shlex
import subprocess
# kitty's launch env has no ATUIN_SESSION (atuin's shell init never ran), so
# seed it here. atuin itself comes from the package manager, on PATH.
atuin = "atuin"
if "ATUIN_SESSION" not in os.environ:
os.environ["ATUIN_SESSION"] = subprocess.run(
[atuin, "uuid"], stdout=subprocess.PIPE, text=True
).stdout.strip()
sel = subprocess.run(
[atuin, "search", "-i", "--filter-mode", "directory"],
stdout=subprocess.PIPE,
text=True,
).stdout.strip()
argv = ["fish"]
if sel:
argv += ["-C", f"echo {shlex.quote('\u276f ' + sel)}; {sel}"]
os.execvp("fish", argv)