Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Apply commands to multiple buffers and manage the argument list.
VimL
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
autoload
doc
plugin
README

README

This is a mirror of http://www.vim.org/scripts/script.php?script_id=4152

DESCRIPTION
This plugin supports you with batch processing many files by extending the
built-in :windo, :argdo, etc. commands. You can filter the argument list,
add files _not_ matching a pattern, convert between arguments and quickfix
list, and apply arbitrary Ex commands (also partially) via :Argdo, then
analyze any errors and retry on an argument list where the successfully
processed arguments have been removed.

RELATED WORKS
- The :ArgsNegated command was inspired by the following Stack Overflow
  question:
    http://stackoverflow.com/questions/11547662/how-can-i-negate-a-glob-in-vim
- The https://github.com/nelstrom/vim-qargs plugin has a :Qargs command
  similar (but more simplistic) than :CListToArgs.
- Pretty Args (vimscript #4681) provides an :Arg command which takes
  filename-modifiers to print a shortened argument list, e.g. just the
  filenames.
- JustDo (vimscript #4981) provides a :BufDo command that skips unmodifiable
  buffers.

USAGE
:[range]Bufdo {cmd}     Execute {cmd} in each buffer in the buffer list, then
                        return back to the original one.
                        Any encountered errors are also put into the
                        quickfix list.

:[range]BufdoWrite {cmd}Execute {cmd} in each buffer in the buffer list and
                        automatically persist any changes (:update).

:[range]Windo {cmd}     Execute {cmd} in each window, then return back to the
                        original one.

:[range]Winbufdo {cmd}  Execute {cmd} in each different buffer shown in one of
                        the windows in the current tab page (once per buffer),
                        then return back to the original one.

:[range]Tabdo {cmd}     Execute {cmd} once in each tab page, then return back
                        to the original one.

:[range]Tabwindo {cmd}  Execute {cmd} in each open window on each tab page,
                        then return back to the original one.

:[range]Argdo {cmd}     Execute {cmd} for each file in the argument list, then
                        return back to the original file and argument.
                        [range] is emulated for older Vim versions, but can
                        only be used interactively (not in scripts).

                        In contrast to :argdo, this also avoids the
                        hit-enter prompt (all files will be processed
                        without further interaction from you), and an error
                        summary will be printed.
                        To work on the errors / arguments with errors, you can
                        use :ArgdoErrors and :ArgdoDeleteSuccessful.
                        Also, any encountered errors are put into the
                        quickfix list.

:[range]ArgdoWrite {cmd}Execute {cmd} in each buffer in the argument list and
                        automatically persist any changes (:update).
:[range]ArgdoConfirmWrite {cmd}
                        Like :ArgdoWrite, but confirm each write, allowing
                        to review the automatically applied changes of {cmd}
                        before persisting them. When you quit the argument
                        processing before the last argument, this will not
                        return to the original file (to make it easier to
                        process the remaining arguments again).

:ArgdoErrors            List all error messages that occurred during the last
                        :Argdo command, and for each unique error, print the
                        argument number and filespec.

:ArgdoDeleteSuccessful  Delete those arguments from the argument list that
                        didn't cause any error messages during the last
                        :Argdo command.

:ArgsFilter {expr}      Apply the filter() of {expr} to the argument list,
                        and keep only those where {expr} yields true. This
                        allows you to :argdelete multiple arguments at once
                        and to delete without specifying the full filename.

:ArgsNegated[!] {arglist}
                        Define all files except {arglist} as the new argument
                        list and edit the first one.

:[range]ArgsList[!]     List each argument number and filespec in a neat list
                        (not just one after the other as :args). With [!],
                        expand all arguments to absolute filespecs.
:[range]ArgsList[!] {glob}
                        List each argument number and filespec that matches
                        (with [!]: does not match) {glob} in a neat list.
                        Matching and printing is done to the full filespec.

:[range]ArgsToQuickfix  Show all arguments as a quickfix list.

:CListToArgs            Convert the files in the quickfix list to arguments.
:[count]CListToArgsAdd

:LListToArgs            Convert the files in the window's location list to
:[count]LListToArgsAdd  arguments.

:CList[!], :LList[!]    List each file that has listed errors in the quickfix
                        / location list in a neat list. With [!], expand all
                        to absolute filespecs.
:CList[!] {glob}        List each file that has listed errors in the quickfix
:LList[!] {glob}        / location list that matches (with [!]: does not
                        match) {glob} in a neat list. Matching and printing is
                        done to the full filespec.

:[range]CDoEntry {cmd}  Execute {cmd} on each entry in the quickfix /
:[range]LDoEntry {cmd}  location list (limited to buffers in [range]).

:[range]CDoFile {cmd}   Execute {cmd} once on each file that appears in the
:[range]LDoFile {cmd}   quickfix / location list (limited to buffers in
                        [range]).

:[range]CDoFixEntry {cmd}
:[range]LDoFixEntry {cmd}
                        Execute {cmd} on each entry in the quickfix / location
                        list (limited to buffers in [range]). If the {cmd}
                        does not abort and changes the buffer (i.e. increases
                        b:changedtick), that entry is removed from the
                        quickfix / location list. Else, the original entry is
                        augmented with error information. (Entries for buffers
                        outside [range] are kept as-is.)
Something went wrong with that request. Please try again.