Files
nixos/home/.local/usr/bin/igrep
2025-08-15 17:44:24 -04:00

17 lines
630 B
Bash
Executable File

#!/usr/bin/env bash
# Check if the first argument is a path and assign it to SEARCH_PATH
SEARCH_PATH="${1:-.}"
# Shift the arguments so any additional arguments are treated as the search pattern for `rg`
shift
# Execute `rg` in the specified path with the search pattern
rg --color=always --line-number --no-heading --smart-case --hidden "${*:-}" "$SEARCH_PATH" |
fzf --ansi \
--color "hl:-1:underline,hl+:-1:underline:reverse" \
--delimiter : \
--preview 'bat --color=always {1} --highlight-line {2}' \
--preview-window 'up,60%,border-bottom,+{2}+3/3,~3' \
--bind 'enter:become(nvim {1} +{2})'