Thanx, this is just what the doctor ordered...
Asis
2010/10/26 Christian Brabandt <cblists@256bit.org>
Hi Asis!
This one here works with the quickfixlist / locationlist (the bang
On Di, 26 Okt 2010, Asis Hallab wrote:
> I recently discovered and used vim's
> args and argdo commands.
>
> Now I wonder if there's a way to execute a command over all search-results
> in the quickfix or location-list?
> E.g.
> vimgrep 'define' **/*.rb
> and then on all files in the quickfix, or location list
> *quickfix_do* %s/define/def/g
>
> Your help is very much appreciated.
form):
fun! QFDo(bang, command)
let qflist={}
if a:bang
let tlist=map(getloclist(0), 'get(v:val, ''bufnr'')')
else
let tlist=map(getqflist(), 'get(v:val, ''bufnr'')')
endif
if empty(tlist)
echomsg "Empty Quickfixlist. Aborting"
return
endif
for nr in tlist
let item=fnameescape(bufname(nr))
if !get(qflist, item,0)
let qflist[item]=1
endif
endfor
:exe 'argl ' .join(keys(qflist))
:exe 'argdo ' . a:command
endfunc
com! -nargs=1 -bang Qfdo :call QFDo(<bang>0,<q-args>)
regards,
Christian
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
--
Asis Hallab
Rothehausstr. 6 - 12
50823 Köln
Skype: asis.hallab.cgn
Fest (Köln) 42346046
Mobil (O2) 0176 63370211
Fax 01212 - 5 - 30697106
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment