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

Long line matches #95

Open
macarthy opened this issue Mar 30, 2015 · 4 comments
Open

Long line matches #95

macarthy opened this issue Mar 30, 2015 · 4 comments

Comments

@macarthy
Copy link

HI there, when I have a match in a compressed JS file I end end with a very large amount of text in the quicklist, is it possible to break the line up into some smaller around the match?

Thanks

@epmatsw
Copy link

epmatsw commented May 13, 2015

I imagine that this would need to be a change in ag itself. There's the context options for printing lines before and after a match, but no option for characters before/after a match.

@losingkeys
Copy link
Collaborator

I've been thinking about this too. I wonder if there's a location/quickfix list option list for this or if we can truncate the matches before they end up in those windows. Otherwise this might be an ag option too.

@Numkil
Copy link

Numkil commented May 14, 2015

You could potentially use the -o switch and a search string like this.
ag -o ".{0,20}Your search keyword here.{0,20}"
This will find the string you are looking for and limit the results ouput to 20 characters before and 20 characters behind.
You could construct the cmd variable while keeping this in mind and keep an copy of the original search term to fix highlighting the search word.

@Numkil
Copy link

Numkil commented May 16, 2015

I'm working on a small pull request to implement my solution, so that you guys can try it out.

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

4 participants