From 70b1dc41f272232852dcc11eca2b14fcf5dffe35 Mon Sep 17 00:00:00 2001 From: "Ian Smith-Heisters, Justin Richard & Phan Le" Date: Tue, 24 Apr 2012 11:40:56 -0700 Subject: [PATCH] Added qfdo --- init/qfdo.vim | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 init/qfdo.vim diff --git a/init/qfdo.vim b/init/qfdo.vim new file mode 100644 index 00000000..9cf7aa18 --- /dev/null +++ b/init/qfdo.vim @@ -0,0 +1,27 @@ +command! -nargs=+ QFDo call QFDo() + +" 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