Closed ahmedelgabri closed 8 years ago
I tried pretty hard to use quotes instead of backslash escaping for the :SideSearch
command.
But you can use the function directly.
:call SideSearch('my terms here') | set hlsearch
Note: The set hlsearch
must be chained here since doing it in the SideSearch function won't work for some reason.
Cool will use this for now, Thanks!
I also noticed that I can't pass options to ag
anymore I'm used to do stuff like this
:Ag --js "Something"
" or
:Ag -G="*.js" "something"
But this doesn't work with :SideSearch
Just committed to master a change that should give you the same flexibility. commit 6b165d75702b1ea61a92e45367f5c6579fb9bf0b
Thanks @ddrscott
The changes that you did for this issue is working fine except when using -G="*.js"
" This works as expected
:Ag --js "Something"
" this doesn't
:Ag -G="*.js" "something"
and this is the error returned
search hit BOTTOM, continuing at TOP
Error detected while processing function SideSearch:
line 33:
E486: Pattern not found: *\.js
I agree it's a problem. The best I can do is suppress the error like Ag is doing. Ag
actually has the same root issue that I have since we're sharing the same regex to parse the search terms from command args.
https://github.com/rking/ag.vim/blob/master/autoload/ag.vim#L154
The regex thinks *.js
is the search term instead of something
. SideSearch raises an error that *.js
is not found in the SideSearch buffer.
For now I've suppressed the error so it's less annoying.
The funny part that -G="*.js"
it actually works, but it shows the error first and doesn't highlight the results. I still get the results screen with the right results.
After the fix it's less annoying which is definitely better but you lose all the functionality or the highlight for the search term.
I'm fine this with fix for now, but it'd be great if it can maintain the plugin functionality too. Thanks again for the help and the awesome plugin.
I found this plugin which also deals with searching & highlighting, also uses Ag
but it passes the the flags/options as is to the command. I tried to understand how it's done but my very minor knowledge of vimscript is not helping so maybe you can find it helpful & can help you to find a fix the issue with passing some flags. https://github.com/wincent/ferret
Looks like https://github.com/wincent/ferret/blob/master/autoload/ferret/private.vim#L177 has a different set of problems from https://github.com/rking/ag.vim/blob/master/autoload/ag.vim#L154.
When I search for :SS -G="*.js" "cats and dogs"
it can't handle the multi word search correctly. I prefer the regex matcher better, through it breaks the highlighting a bit. I'm not sure this is going to be solvable in my free time.
It's not a big deal, I can still search again inside the results buffer to highlight the results a tiny bit not convenient but it works. Thanks anyway 👍
First I want to thank you for this, it's really a nice plugin. I have a feedback and may be a bug.
"my terms here"
instead of backslashes if possible.FunctionName(
withag.vim
I could doFunctioName\(
and it will work. But this doesn't work, also I triedFunctionName(
and"FunctionName("
. So I'm not quite sure how to do this?