Sunday, November 3, 2013

Re: analog to :{buf,arg,win,tab}do for quickfix?

Am 24.10.2013 23:19, schrieb Tim Chase:
> I've got some results from a :vimgrep in a quickfix window and would
> like to perform Ex operations across them, something like (imagined)
>
> :vimgrep /\s\+$/ lots*of*files.py
> :cdo s/\s\+$//|w "if it iterates by quickfix lines
>
> or
>
> :cdo %s/\s\+$//|w "if it iterates by quickfix files
>
>
> I can hack my way around it for now with some macros, but this is the
> 2nd or 3rd time recently that I've reached for this sort of
> functionality and shrugged. So I figured it was at least worth
> asking if anybody had suggestions.
>
> -tim

Try this user command.

com! -nargs=1 -complete=command CfileDo
\ set ei+=Syntax
\|try
\|cfirst<bang>
\|while 1
\|exec <q-args>
\|cnfile<bang>
\|endwhile
\|catch /:E553:/
\|finally
\|set ei-=Syntax
\|endtry

Example:
:CfileDo %s/\s\+$//e|w

There is no `:filetype detect` at the end ... would clear a hit-enter prompt.

--
Andy

--
--
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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: