thanks to the help of Christian Brabandt, there's a function in my .vimrc
to execute any vim-command on all files in the Quickfixlist or the Locationlist.
This is somewhat analogous to :argdo.
So, I should be able to do something like:
vimgrep validate app/models/*
:Qfdo %s/validate/VALIUM/ge | update
Unfortunately, this results in an error,
that the first changed file has to be saved,
before switching to the next one:
E37: No write since last change (add ! to overwrite)
I think, that the | update is not executed, is it?
What do I need to change in the following .vimrc's code?
" Define Function Quick-Fix-List-Do:
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 -bar Qfdo :call QFDo(<bang>0,<q-args>)
Many thanks in advance for your help!
Kind regards!
Asis
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