Skip to content

Instantly share code, notes, and snippets.

@ugovaretto
Created January 8, 2024 10:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugovaretto/cfbe030da2d9764dde094712a318fa1d to your computer and use it in GitHub Desktop.
Save ugovaretto/cfbe030da2d9764dde094712a318fa1d to your computer and use it in GitHub Desktop.
Atuin configuration file
#Atuin configuration for fish is broken as of 2024-1-8 (using $"(...)" instead of (...))
#Add source <this file> to $HOME/.config/fish/config.fish
set -gx ATUIN_SESSION (atuin uuid)
function _atuin_preexec --on-event fish_preexec
if not test -n "$fish_private_mode"
set -g ATUIN_HISTORY_ID (atuin history start -- "$argv[1]")
end
end
function _atuin_postexec --on-event fish_postexec
set -l s $status
if test -n "$ATUIN_HISTORY_ID"
ATUIN_LOG=error atuin history end --exit $s -- $ATUIN_HISTORY_ID &>/dev/null &
disown
end
set --erase ATUIN_HISTORY_ID
end
function _atuin_search
set -l ATUIN_H (ATUIN_SHELL_FISH=t ATUIN_LOG=error atuin search $argv -i -- (commandline -b) 3>&1 1>&2 2>&3)
if test -n "$ATUIN_H"
if string match --quiet '__atuin_accept__:*' "$ATUIN_H"
set -l ATUIN_HIST (string replace "__atuin_accept__:" "" -- "$ATUIN_H")
commandline -r "$ATUIN_HIST"
commandline -f repaint
commandline -f execute
return
else
commandline -r "$ATUIN_H"
end
end
commandline -f repaint
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment