citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

search-files (487B)


      1 #!/usr/bin/env bash
      2 set -e
      3 INITIAL_QUERY=""
      4 if [ -n "$1" ]; then
      5         INITIAL_QUERY="${@: -1}"
      6 fi
      7 export RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
      8 export FZF_DEFAULT_COMMAND="$RG_PREFIX $@"
      9 res=$(fzf --bind "change:reload:$RG_PREFIX {q} || true" --ansi --phony --query "$INITIAL_QUERY")
     10 #file=$(readlink -f $(cut -d: -f1 <<<"$res"))
     11 file=$(cut -d: -f1 <<<"$res")
     12 line=$(cut -d: -f2 <<<"$res")
     13 
     14 echo +$line \"$file\" "# $(cut -d: -f4- <<<"$res")"