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

Unable to open a searched file on macOS #240

Closed
h4rsh-k opened this issue Aug 6, 2024 · 5 comments · Fixed by #260
Closed

Unable to open a searched file on macOS #240

h4rsh-k opened this issue Aug 6, 2024 · 5 comments · Fixed by #260
Labels
bug Something isn't working

Comments

@h4rsh-k
Copy link

h4rsh-k commented Aug 6, 2024

Describe the bug
I search for some using rga-fzf foo and then do a enter on the file name in the results sidebar. However I am getting an error - Error: No such file or directory (os error 2)

To Reproduce

Attach example file:

Run command:

Output

Screenshots
If applicable, add screenshots to help explain your problem.

image

Operating System and Version
MacOS Sonoma 14.1.2

Output of rga --version
ripgrep-all 0.10.6 - Installed via homebrew

@h4rsh-k h4rsh-k added the bug Something isn't working label Aug 6, 2024
@justinmayer
Copy link

I can confirm these same errors with ripgrep-all 0.10.6, installed via Homebrew on MacOS Sonoma 14.7. I had to revert to the shell functions listed in the wiki.

@yunake
Copy link

yunake commented Oct 9, 2024

It's hardcoded to try Evince, and xdg-open barring that:

let worked = Command::new("evince")

It's needs to use open on MacOS instead. You can either install Evince, alias it, use a modified script from the wiki or change the code yourself and recompile.

@phiresky
Copy link
Owner

phiresky commented Oct 10, 2024

the rga-fzf-open script is pretty hacky in general. I should probably remove or replace it with something more clean / configurable

@justinmayer
Copy link

@yunake: The current behavior seems to only try evince for PDF files, so installing Evince alone is not sufficient as a workaround if you plan to open any other (non-PDF) file types. As a temporary workaround, the following was sufficient for me:

ln -s /usr/bin/open $HOME/.local/bin/xdg-open

@phiresky: Personally, I believe the bundled script has value. Rather than removing it, I suggest a fix along the lines of the above-linked pull request. Then perhaps a subsequent iteration with more configurability would also be very welcome. 😊

@phiresky
Copy link
Owner

phiresky commented Oct 11, 2024

Well the only reason why evince is hard coded is because it actually opens the find menu on evince (via --find) and thus scrolls the PDF automatically to the appropriate section. So replacing that needs a syntax to allow that for arbitrary file types and arbitrary operating systems, if it's the same for each file extension then the script is kind of pointless, and since custom adapters exists it also needs to be configurable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants