diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 16:10:29 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 16:10:29 +0200 |
| commit | 97f207b771b94c5285faae4810d6eeda1b78926b (patch) | |
| tree | 4482544233c30e0e9a62be6afcfe92c8e01b0a50 /crates/turtle/src/shell/atuin.zsh | |
| parent | chore: Remove all `pub`s (diff) | |
| download | atuin-97f207b771b94c5285faae4810d6eeda1b78926b.zip | |
chore(server): Simplify the database support
Diffstat (limited to '')
| -rw-r--r-- | crates/turtle/src/shell/atuin.zsh | 56 |
1 files changed, 1 insertions, 55 deletions
diff --git a/crates/turtle/src/shell/atuin.zsh b/crates/turtle/src/shell/atuin.zsh index 7a7375aa..7e7fef27 100644 --- a/crates/turtle/src/shell/atuin.zsh +++ b/crates/turtle/src/shell/atuin.zsh @@ -91,65 +91,11 @@ _atuin_precmd() { export ATUIN_HISTORY_ID="" } -# Check if tmux popup is available (tmux >= 3.2) -__atuin_tmux_popup_check() { - [[ -n "${TMUX-}" ]] || return 1 - [[ "${ATUIN_TMUX_POPUP:-true}" != "false" ]] || return 1 - - # https://github.com/tmux/tmux/wiki/FAQ#how-often-is-tmux-released-what-is-the-version-number-scheme - local tmux_version - tmux_version=$(tmux -V 2>/dev/null | sed -n 's/^[^0-9]*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/p') # Could have used grep... - [[ -z "$tmux_version" ]] && return 1 - - local m1 m2 - m1=${tmux_version%%.*} - m2=${tmux_version#*.} - m2=${m2%%.*} - [[ "$m1" =~ ^[0-9]+$ ]] || return 1 - [[ "$m2" =~ ^[0-9]+$ ]] || m2=0 - (( m1 > 3 || (m1 == 3 && m2 >= 2) )) -} - -# Use global variable to fix scope issues with traps -__atuin_popup_tmpdir="" -__atuin_tmux_popup_cleanup() { - [[ -n "$__atuin_popup_tmpdir" && -d "$__atuin_popup_tmpdir" ]] && command rm -rf "$__atuin_popup_tmpdir" - __atuin_popup_tmpdir="" -} - __atuin_search_cmd() { local -a search_args=("$@") - if __atuin_tmux_popup_check; then - __atuin_popup_tmpdir=$(mktemp -d) || return 1 - local result_file="$__atuin_popup_tmpdir/result" - - trap '__atuin_tmux_popup_cleanup' EXIT HUP INT TERM - local escaped_query escaped_args - escaped_query=$(printf '%s' "$BUFFER" | sed "s/'/'\\\\''/g") - escaped_args="" - for arg in "${search_args[@]}"; do - escaped_args+=" '$(printf '%s' "$arg" | sed "s/'/'\\\\''/g")'" - done - - # In the popup, atuin goes to terminal, stderr goes to file - local cdir popup_width popup_height - cdir=$(pwd) - popup_width="${ATUIN_TMUX_POPUP_WIDTH:-80%}" # Keep default value anyways - popup_height="${ATUIN_TMUX_POPUP_HEIGHT:-60%}" - tmux display-popup -d "$cdir" -w "$popup_width" -h "$popup_height" -E -E -- \ - sh -c "PATH='$PATH' ATUIN_SESSION='$ATUIN_SESSION' ATUIN_SHELL=zsh ATUIN_LOG=error ATUIN_QUERY='$escaped_query' atuin search $escaped_args -i 2>'$result_file'" - - if [[ -f "$result_file" ]]; then - cat "$result_file" - fi - - __atuin_tmux_popup_cleanup - trap - EXIT HUP INT TERM - else - ATUIN_SHELL=zsh ATUIN_LOG=error ATUIN_QUERY=$BUFFER atuin search "${search_args[@]}" -i 3>&1 1>&2 2>&3 3>&- - fi + ATUIN_SHELL=zsh ATUIN_LOG=error ATUIN_QUERY=$BUFFER atuin search "${search_args[@]}" -i 3>&1 1>&2 2>&3 3>&- } _atuin_search() { |
