Skip to content

Commit

Permalink
Added qfdo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Smith-Heisters, Justin Richard & Phan Le committed Apr 24, 2012
1 parent 3dcad4e commit 70b1dc4
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions init/qfdo.vim
@@ -0,0 +1,27 @@
command! -nargs=+ QFDo call QFDo(<q-args>)

" Function that does the work
function! QFDo(command)
" Create a dictionary so that we can
" get the list of buffers rather than the
" list of lines in buffers (easy way
" to get unique entries)
let buffer_numbers = {}
" For each entry, use the buffer number as
" a dictionary key (won't get repeats)
for fixlist_entry in getqflist()
let buffer_numbers[fixlist_entry['bufnr']] = 1
endfor
" Make it into a list as it seems cleaner
let buffer_number_list = keys(buffer_numbers)

" For each buffer
for num in buffer_number_list
" Select the buffer
exe 'buffer' num
" Run the command that's passed as an argument
exe a:command
" Save if necessary
update
endfor
endfunction

0 comments on commit 70b1dc4

Please sign in to comment.