Wilfred / ag.el

An Emacs frontend to The Silver Searcher
http://agel.readthedocs.org/en/latest/
525 stars 61 forks source link

Treat numeric prefix as --context=... argument to ag #109

Closed wbolster closed 8 years ago

wbolster commented 8 years ago

A positive numeric prefix is treated as just the number of context number. A negative numeric prefix allows further modification of the ag command line, just like a non-numeric prefix argument already did.

Closes #107.

Wilfred commented 8 years ago

Thanks, I agree this is a nice feature. Sorry for the delay on this.

Wilfred commented 8 years ago

Merged, thank you :)

I think ideally we'd allow people to navigate to the context lines too, what do you think? Currently they can only press enter on the matching line, not the surrounding context lines.

wbolster commented 8 years ago

you're welcome.

i think the navigation is fine as it is now. next-error and previous-error (both of which have shortcuts in my setup) work just fine. context larger than a few lines is useless anyway, hence navigating to the context lines starting from the actual match just takes a few key strokes.

e.g. in my vim-inspired and heavily tweaked setup i can run ag on the current project searching for the symbol at point using a few magic key strokes:

, a g RET

...and navigate around using [ e and ] e

with 3 context lines around each match, this would become:

3 , a g RET (only one extra press!)