rking / ag.vim

Vim plugin for the_silver_searcher, 'ag', a replacement for the Perl module / CLI script 'ack'
1.74k stars 131 forks source link

Add results to the buffers list? #133

Open rafaelrinaldi opened 8 years ago

rafaelrinaldi commented 8 years ago

Is there a way to add all the search matches to the buffers list? That would be really handy for "search and replace" kinda thing.

Thanks.

rafaelrinaldi commented 8 years ago

Just as a reference, there's this screencast on Vimcasts.org that suggests a simple snippet to populate the arglist with everything inside the quickfix list.

command! -nargs=0 -bar Qargs execute 'args' QuickfixFilenames()
function! QuickfixFilenames()
  " Building a hash ensures we get each buffer only once
  let buffer_numbers = {}
  for quickfix_item in getqflist()
    let buffer_numbers[quickfix_item['bufnr']] = bufname(quickfix_item['bufnr'])
  endfor
  return join(map(values(buffer_numbers), 'fnameescape(v:val)'))
endfunction

It would be nice to trigger this from ag.vim.