Using Ag it's self or ag with ctrl-p, I'm able to ignore the directories that are listed in my .gitignore. This is infact default for Ag, but for some reason, FZF with ag isn't doing the same.
https://github.com/mhartington/dotfiles/blob/master/nvimrc#L368
function! s:ag_handler(lines)
if len(a:lines) < 2 | return | endif
let cmd = get({'ctrl-x': 'split',
\ 'ctrl-v': 'vertical split',
\ 'ctrl-t': 'tabe'}, a:lines[0], 'e')
let list = map(a:lines[1:], 's:ag_to_qf(v:val)')
let first = list[0]
execute cmd escape(first.filename, ' %#\')
execute first.lnum
execute 'normal!' first.col.'|zz'
if len(list) > 1
call setqflist(list)
copen
wincmd p
endif
endfunction
command! -nargs=* Ag call fzf#run({
\ 'source': printf('ag --nogroup --column --nocolor "%s"',
\ escape(empty(<q-args>) ? '^(?=.)' : <q-args>, '"\')),
\ 'sink*': function('<sid>ag_handler'),
\ 'options': '--ansi --expect=ctrl-t,ctrl-v,ctrl-x --delimiter : --nth 4.. '.
\ '--multi --bind ctrl-a:select-all,ctrl-d:deselect-all ',
\ 'down': '35%'
\ }) "}}}
"}}}
"
Any idea whats up?
By the way, love the plugin, so fast!
Does ag --nogroup --column --nocolor QUERY give you the expected result? Then I don't see how your Ag command can go wrong.
FYI, you might also want to check out fzf.vim repository that I recently started working on; https://github.com/junegunn/fzf.vim
Hmm, I thought I had copied that down, but it appears to work when I use your plugin. Thanks a lot!
One last question if you don't mind, is there any way to make the default :FZF function respect your git ignore as well?
It looks like you misunderstood the Ag example. The Ag command you copied from the wiki is not just for listing files, but for searching for the given text in the files a la grep. And having the above Ag command in your .vimrc obviously does not affect :FZF command.
The answer to your question is on the README page. See https://github.com/junegunn/fzf#respecting-gitignore-hgignore-and-svnignore
Ahh alright, I wasn't aware that the shell command and options would also be used in vim. Thanks for pointing that out.