Skip to content

Running Ripgrep on files #3710

Closed Answered by LangLangBart
limaceous-bushwhacker asked this question in Q&A
Discussion options

You must be logged in to vote

Two Ideas

A: Direct Approach

We attempt to map the capability of searching a specified number of files with ripgrep to a single
hotkey. This approach sacrifices readability, and one must navigate the complexities of escaping and
quoting.

RG_PREFIX=$'rg --with-filename --column --line-number --no-heading --color=always --smart-case ${FZF_QUERY:-\'""\'} -- $(while IFS= read -r line; do printf "%q " "$line"; done < /tmp/rg_files) || true'
fzf \
  --ansi \
  --multi \
  --delimiter : \
  --bind 'start:execute-silent(: >/tmp/rg_files)+unbind:change' \
  --bind "ctrl-r:rebind(change)+unbind(ctrl-r)+disable-search+clear-query+execute-silent(cp {+f} /tmp/rg_files)+change-preview(bat --color=alway…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@limaceous-bushwhacker
Comment options

Answer selected by limaceous-bushwhacker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants