atuin-pick: run selection in interactive fish via --init-command

This commit is contained in:
Prad Nukala committed 2026-08-14 14:03:50 -04:00
1 parent ed81583e02
commit 4fabb40040
1 file changed
+8 -7
+8 -7
View File
@@ -3,14 +3,14 @@
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. Run the selection with rc loaded so aliases and functions
resolve — its output stays in this split — then drop to an interactive
shell.
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 shutil
import subprocess
import sys
# kitty's launch env has neither ~/.atuin/bin on PATH nor ATUIN_SESSION
# (atuin's shell init never ran), so resolve and seed both here.
@@ -25,7 +25,8 @@ sel = subprocess.run(
stdout=subprocess.PIPE,
text=True,
).stdout.strip()
argv = ["fish"]
if sel:
print(f"\u276f {sel}", file=sys.stderr)
subprocess.run(["zsh", "-ic", "--", sel])
os.execvp("zsh", ["zsh", "-i"])
argv += ["-C", f"echo {shlex.quote('\u276f ' + sel)}; {sel}"]
os.execvp("fish", argv)