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

feature request: batgrep support for ripgrep's --hyperlink-format #129

Open
llimllib opened this issue Sep 26, 2024 · 2 comments
Open

feature request: batgrep support for ripgrep's --hyperlink-format #129

llimllib opened this issue Sep 26, 2024 · 2 comments

Comments

@llimllib
Copy link
Contributor

llimllib commented Sep 26, 2024

I made an attempt:

diff --git a/src/batgrep.sh b/src/batgrep.sh
index 1f02138..e521abe 100755
--- a/src/batgrep.sh
+++ b/src/batgrep.sh
@@ -247,6 +247,11 @@ while shiftopt; do
 		RG_ARGS+=("$OPT" "$OPT_VAL")
 		;;
 
+	--hyperlink-format*)
+		RG_ARGS+=("$OPT=$OPT_VAL")
+		;;
+
 	# bat options
 
 	# Script options

But the hyperlinks don't come through like I was hoping, and I got pretty stumped trying to figure out why.

clicking on a hyperlink to open the file at the spot where the match is is one of my favorite features of ripgrep, and I'd love to use it with batgrep.

@eth-p
Copy link
Owner

eth-p commented Sep 26, 2024

This would have to be something implemented on bat's end, unfortunately.

The main issue is that while bat can parse and re-emit hyperlinks correctly, it can't correctly perform syntax highlighting against source code with embedded escape sequences.

I would also need to update batgrep to read the escape sequences, and that would be both slow and not very practical.

That being said... If you want to open a feature request for adding hyperlinks to line numbers on bat's end, I could try implementing that at some point when I have free time.

@llimllib
Copy link
Contributor Author

There is an issue on bat already: sharkdp/bat#2158

(Sorry, I should have linked that one to this one)

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