I have found a lot of pages with config examples such as:
let g:unite_source_grep_command = 'ag'
let g:unite_source_grep_default_opts =
\ '--line-numbers --nocolor --nogroup --hidden --ignore '
let g:unite_source_grep_recursive_opt = ''
or
" Use ag for searching
let g:unite_source_rec_async_command =
\ 'ag --follow --nocolor --nogroup --hidden -g ""'
let g:ackprg = 'ag --nogroup --column'
nnoremap <space>/ :Unite grep:.<cr>
Unfortunately, I don't really understand what these are doing or why. What I've played around with it some and have gotten parts of what I want working.
Ideally, I'd just like something similar to what Ack.vim does:
Perhaps I'm missing the spirit of this question, but if you just need to configure Unite with ag, that's straightforward: in your .vimrc add:
let g:unite_source_grep_command="ag"
let g:unite_source_grep_default_opts="-i --nocolor --nogroup"
In vim, you would invoke a search like so:
:Unite grep:.
pattern: foobar
Note: Unite doesn't comes with pre-defined mappings, so you have to add your own. If Unite is too much functionality for your needs, consider using Ack.vim with ag (Ag.vim is no longer maintained.) Both plugins fulfill your ideal usage patten; but Unite does a whole bunch more.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With