forked from pivotalforks/vim-config
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 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.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |