Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 126 lines (102 sloc) 6.458 kB
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
1 This is a mirror of http://www.vim.org/scripts/script.php?script_id=4152
2
3 DESCRIPTION
4 This plugin supports you with batch processing many files by extending the
5 built-in :windo, :argdo, etc. commands. You can filter the argument list,
6 add files _not_ matching a pattern, convert between arguments and quickfix
7 list, and apply arbitrary Ex commands (also partially) via :Argdo, then
8 analyze any errors and retry on an argument list where the successfully
9 processed arguments have been removed.
10
11 RELATED WORKS
12 - The :ArgsNegated command was inspired by the following Stack Overflow
13 question:
14 http://stackoverflow.com/questions/11547662/how-can-i-negate-a-glob-in-vim
884c1d0 Version 1.20
Ingo Karkat authored
15 - The https://github.com/nelstrom/vim-qargs plugin has a :Qargs command
16 similar (but more simplistic) than :CListToArgs.
86a2deb Version 2.00
Ingo Karkat authored
17 - Pretty Args (vimscript #4681) provides an :Arg command which takes
18 filename-modifiers to print a shortened argument list, e.g. just the
19 filenames.
20 - JustDo (vimscript #4981) provides a :BufDo command that skips unmodifiable
21 buffers.
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
22
23 USAGE
86a2deb Version 2.00
Ingo Karkat authored
24 :[range]Bufdo {cmd} Execute {cmd} in each buffer in the buffer list, then
884c1d0 Version 1.20
Ingo Karkat authored
25 return back to the original one.
26 Any encountered errors are also put into the
27 quickfix list.
28
86a2deb Version 2.00
Ingo Karkat authored
29 :[range]BufdoWrite {cmd}Execute {cmd} in each buffer in the buffer list and
884c1d0 Version 1.20
Ingo Karkat authored
30 automatically persist any changes (:update).
4786144 Version 1.10
Ingo Karkat authored
31
86a2deb Version 2.00
Ingo Karkat authored
32 :[range]Windo {cmd} Execute {cmd} in each window, then return back to the
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
33 original one.
34
86a2deb Version 2.00
Ingo Karkat authored
35 :[range]Winbufdo {cmd} Execute {cmd} in each different buffer shown in one of
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
36 the windows in the current tab page (once per buffer),
37 then return back to the original one.
38
86a2deb Version 2.00
Ingo Karkat authored
39 :[range]Tabdo {cmd} Execute {cmd} once in each tab page, then return back
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
40 to the original one.
41
86a2deb Version 2.00
Ingo Karkat authored
42 :[range]Tabwindo {cmd} Execute {cmd} in each open window on each tab page,
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
43 then return back to the original one.
44
86a2deb Version 2.00
Ingo Karkat authored
45 :[range]Argdo {cmd} Execute {cmd} for each file in the argument list, then
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
46 return back to the original file and argument.
86a2deb Version 2.00
Ingo Karkat authored
47 [range] is emulated for older Vim versions, but can
48 only be used interactively (not in scripts).
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
49
50 In contrast to :argdo, this also avoids the
51 hit-enter prompt (all files will be processed
52 without further interaction from you), and an error
53 summary will be printed.
54 To work on the errors / arguments with errors, you can
55 use :ArgdoErrors and :ArgdoDeleteSuccessful.
884c1d0 Version 1.20
Ingo Karkat authored
56 Also, any encountered errors are put into the
57 quickfix list.
58
86a2deb Version 2.00
Ingo Karkat authored
59 :[range]ArgdoWrite {cmd}Execute {cmd} in each buffer in the argument list and
884c1d0 Version 1.20
Ingo Karkat authored
60 automatically persist any changes (:update).
86a2deb Version 2.00
Ingo Karkat authored
61 :[range]ArgdoConfirmWrite {cmd}
11729d4 Version 1.22
Ingo Karkat authored
62 Like :ArgdoWrite, but confirm each write, allowing
63 to review the automatically applied changes of {cmd}
64 before persisting them. When you quit the argument
65 processing before the last argument, this will not
66 return to the original file (to make it easier to
67 process the remaining arguments again).
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
68
69 :ArgdoErrors List all error messages that occurred during the last
70 :Argdo command, and for each unique error, print the
71 argument number and filespec.
72
73 :ArgdoDeleteSuccessful Delete those arguments from the argument list that
74 didn't cause any error messages during the last
75 :Argdo command.
76
77 :ArgsFilter {expr} Apply the filter() of {expr} to the argument list,
78 and keep only those where {expr} yields true. This
79 allows you to :argdelete multiple arguments at once
80 and to delete without specifying the full filename.
81
82 :ArgsNegated[!] {arglist}
83 Define all files except {arglist} as the new argument
84 list and edit the first one.
85
86a2deb Version 2.00
Ingo Karkat authored
86 :[range]ArgsList[!] List each argument number and filespec in a neat list
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
87 (not just one after the other as :args). With [!],
88 expand all arguments to absolute filespecs.
86a2deb Version 2.00
Ingo Karkat authored
89 :[range]ArgsList[!] {glob}
90 List each argument number and filespec that matches
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
91 (with [!]: does not match) {glob} in a neat list.
92 Matching and printing is done to the full filespec.
93
86a2deb Version 2.00
Ingo Karkat authored
94 :[range]ArgsToQuickfix Show all arguments as a quickfix list.
7950c0b Version 1.00: Initial upload
Ingo Karkat authored
95
96 :CListToArgs Convert the files in the quickfix list to arguments.
97 :[count]CListToArgsAdd
98
99 :LListToArgs Convert the files in the window's location list to
100 :[count]LListToArgsAdd arguments.
11729d4 Version 1.22
Ingo Karkat authored
101
102 :CList[!], :LList[!] List each file that has listed errors in the quickfix
103 / location list in a neat list. With [!], expand all
104 to absolute filespecs.
105 :CList[!] {glob} List each file that has listed errors in the quickfix
106 :LList[!] {glob} / location list that matches (with [!]: does not
107 match) {glob} in a neat list. Matching and printing is
108 done to the full filespec.
848dec4 Version 2.10
Ingo Karkat authored
109
110 :[range]CDoEntry {cmd} Execute {cmd} on each entry in the quickfix /
111 :[range]LDoEntry {cmd} location list (limited to buffers in [range]).
112
113 :[range]CDoFile {cmd} Execute {cmd} once on each file that appears in the
114 :[range]LDoFile {cmd} quickfix / location list (limited to buffers in
115 [range]).
116
117 :[range]CDoFixEntry {cmd}
118 :[range]LDoFixEntry {cmd}
119 Execute {cmd} on each entry in the quickfix / location
120 list (limited to buffers in [range]). If the {cmd}
121 does not abort and changes the buffer (i.e. increases
122 b:changedtick), that entry is removed from the
123 quickfix / location list. Else, the original entry is
124 augmented with error information. (Entries for buffers
125 outside [range] are kept as-is.)
Something went wrong with that request. Please try again.