Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0c71ec1

Browse files
committed
CRITICAL: Move fuzzy function inside HERE document template
- The fuzzy function was defined OUTSIDE the EOF marker - This meant it wasn't written to shell_integration.sh - Fresh installs via curl were missing the pipe-based fuzzy function - Now fuzzy() function is properly included in the generated file - Fixes shell integration for all fresh curl installs
1 parent cef7948 commit 0c71ec1

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

install_standalone.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,45 @@ alias fuzzy-ingest="$FUZZYSHELL_CMD --ingest"
338338
alias fuzzy-rebuild="$FUZZYSHELL_CMD --rebuild-ann"
339339
alias fuzzy-update="curl -sSL https://raw.githubusercontent.com/mitchins/fuzzyshell/main/install_standalone.sh | bash"
340340
341+
# Main fuzzy function with pipe-based command insertion
342+
# Unalias any existing fuzzy alias first
343+
unalias fuzzy 2>/dev/null || true
344+
345+
fuzzy() {
346+
local pipe_file="$HOME/.fuzzyshell/selection_$$"
347+
348+
# Run fuzzy with result pipe
349+
FUZZYSHELL_RESULT_FILE="$pipe_file" "$FUZZYSHELL_CMD" "$@"
350+
local exit_code=$?
351+
352+
# Check if a command was selected via pipe
353+
if [ -f "$pipe_file" ]; then
354+
local selected_cmd=$(cat "$pipe_file")
355+
rm -f "$pipe_file"
356+
357+
if [ -n "$selected_cmd" ]; then
358+
if [ -n "$ZSH_VERSION" ]; then
359+
# ZSH: Insert into command line buffer
360+
print -z "$selected_cmd"
361+
elif [ -n "$BASH_VERSION" ]; then
362+
# Bash: Add to history and display
363+
history -s "$selected_cmd"
364+
echo "Selected: $selected_cmd"
365+
else
366+
# Fallback: just echo the command
367+
echo "$selected_cmd"
368+
fi
369+
fi
370+
fi
371+
372+
return $exit_code
373+
}
374+
375+
# Additional aliases
376+
alias fuzzy-ingest="$FUZZYSHELL_CMD --ingest"
377+
alias fuzzy-rebuild="$FUZZYSHELL_CMD --rebuild-ann"
378+
alias fuzzy-update="curl -sSL https://raw.githubusercontent.com/mitchins/fuzzyshell/main/install_standalone.sh | bash"
379+
341380
# Silent check on startup (only show if verbose mode)
342381
if [ -n "$FUZZYSHELL_VERBOSE" ]; then
343382
echo "✓ FuzzyShell ready (Ctrl+F to search)"

0 commit comments

Comments
 (0)