Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Configuration of fzf and Help for rga-fzf and rga-fzf-open #207

Open
lamyergeier opened this issue Feb 2, 2024 · 1 comment
Open

Comments

@lamyergeier
Copy link

lamyergeier commented Feb 2, 2024

Please include help for rga-fzf and rga-fzf-open (like rga-fzf -h, rga-fzf-open -h)

I just started using this tool, and I am not sure how to use these. I have fzf. May be prevent fzf from using its own config file as I get the following error: Error: fzf output not two line

  • And may we can specify the config from fzf in ripgrep-all/config.jsoc in the same way mpv specify the config for yt-dlp so that it does not conflicts with the standard config of yt-dlp and can override it.
@juanMarinero
Copy link

juanMarinero commented Oct 1, 2024

I also want to customize rga-fzf.

xdg-open is fine, but I want to vim to the line found in regex match.

How to edit rga-fzf so I get both filename and line of regex match? And if file of type text (and default text editor is vim, alike: xdg-mime query default text/plain) then vim that file to the returned line.

Workaround without rpa. Thanks to @BuonOmo comment. Call it like:
fzf_jump_to_regex_in_multiple_files "regex1" "regex2" "etc"
Press Enter to vim file at regex match line.

fzf_jump_to_regex_in_multiple_files() {   
  # ripgrep (rg) searchs an empty regex pattern (everything) --> every line of every file --> slow !!
  rg --line-number --no-heading "" |
	fzf \
	--delimiter=: \
	--preview='batcat --color=always {1} --highlight-line={2}' \
	--preview-window='~3,+{2}+3/4' \
        --query="$*" \
        --bind "enter:become(vim {1} +{2})" \
        --bind 'down:preview-down,up:preview-up'
} 

Edit: example and output

git clone https://github.com/ohmyzsh/ohmyzsh
cd ~/.oh-my-zsh
fzf_jump_to_regex_in_multiple_files  "oh" "my" "plug"

Then next is opened:
Screenshot from 2024-10-14 12-50-29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants