ag icon indicating copy to clipboard operation
ag copied to clipboard

(Optionally) set @/ (search register)

Open blueyed opened this issue 11 years ago • 4 comments

It would be useful if the plugin would set the search register (@/) automatically after searching.

What do you think? There should probably be an option for this (off by default)?

blueyed avatar Jan 26 '15 11:01 blueyed

My main concern here would be that pcre and vim's regex are very different, so setting the search register would only be helpful if the search was a very basic one. What is the use case you are attempting to solve?

ervandew avatar Jan 26 '15 16:01 ervandew

pcre and vim's regex are very different, so setting the search register would only be helpful if the search was a very basic one

Yes, that's a limitation I'm aware of. Although there's some basic conversation already.

My use case is that I often want to search for the string :Ag foo independently from the quickfix list, e.g. in another file, which is not included in the search etc. Additionally I'd like use just n/N sometimes instead of the quickfix list, although I have vim-unimpaired for this already.

blueyed avatar Jan 26 '15 16:01 blueyed

I was thinking about this some more and I'm reluctant to add a feature that will only work part of the time. To do this fully I think it would have to convert the pcre pattern to a vim pattern, and doing so would probably result in an endless stream of issues.

ervandew avatar Feb 03 '15 16:02 ervandew

Agreed.

But exporting the current conversions method would be helpful when creating custom maps for this. Something like ag#convert_pattern_to_vim and ag#get_current_pattern etc.

blueyed avatar Feb 03 '15 17:02 blueyed