cursor will be
positioned at the first non-blank in the line, otherwise the last know column
is used. If there is no last known cursor position the cursor will be in the
first line (the last line in Ex mode).
*{arglist}*
The wildcards in the argument list are expanded and the file names are sorted.
Thus you can use the command `vim *.c` to edit all the C files. From within
Vim the command `:n *.c` does the same.
White space is used to separate file names. Put a backslash before a space or
tab to include it in a file name. E.g., to edit the single file "foo bar": >
:next foo\ bar
On Unix and a few other systems you can also use backticks, for example: >
:next `find . -name \\*.c -print`
The backslashes before the star are required to prevent "*.c" to be expanded
by the shell before executing the find program.
*arglist-position*
When there is an argument list you can see which file you are editing in the
title of the window (if there is one and 'title' is on) and with the file
message you get with the "CTRL-G" command. You will see something like
(4 of 11)
If you are not really editing the file at the current position in the argument
list it will be
((4) of 11)
This means that you are position 4 in the argument list, but not editing the
fourth file in the argument list. This happens when you do ":e file".
LOCAL ARGUMENT LIST
*:arglocal*
:argl[ocal] Make a local copy of the global argument list.
Doesn't start editing another file.
:argl[ocal][!] [++opt] [+cmd] {arglist}
Define a new argument list, which is local to the
current window. Works like |:args_f| otherwise.
*:argglobal*
:argg[lobal] Use the global argument list for the current window.
Doesn't start editing another file.
:argg[lobal][!] [++opt] [+cmd] {arglist}
Use the global argument list for the current window.
Define a new global argument list like |:args_f|.
All windows using the global argument list will see
this new list.
There can be several argument lists. They can be shared between windows.
When they are shared, changing the argument list in one window will also
change it in the other window.
When a window is split the new window inherits the argument list from the
current window. The two windows then share this list, until one of them uses
|:arglocal| or |:argglobal| to use another argument list.
USING THE ARGUMENT LIST
*:argdo*
:[range]argdo[!] {cmd} Execute {cmd} for each file in the argument list or,
if [range] is specified, only for arguments in that
range. It works like doing this: >
:rewind
:{cmd}
:next
:{cmd}
etc.
< When the current file can't be |abandon|ed and the [!]
is not present, the command fails.
When an error is detected on one file, further files
in the argument list will not be visited.
The last file in the argument list (or where an error
occurred) becomes the current file.
{cmd} can contain '|' to concatenate several commands.
{cmd} must not change the argument list.
Note: While this command is executing, the Syntax
autocommand event is disabled by adding it to
'eventignore'. This considerably speeds up editing
each file.
Also see |:windo|, |:tabdo|, |:bufdo|, |:cdo|, |:ldo|,
|:cfdo| and |:lfdo|.
Example: >
:args *.c
:argdo set ff=unix | update
This sets the 'fileformat' option to "unix" and writes the file if it is now
changed. This is done for all `*.c` files.
Example: >
:args *.[ch]
:argdo %s/\<my_foo\>/My_Foo/ge | update
This changes the word "my_foo" to "My_Foo" in all "*.c" and "*.h" files. The "e"
flag is used for the ":substitute" command to avoid an error for files where
"my_foo" isn't used. ":update" writes the file only if changes were made.
==============================================================================
4. Writing *writing* *save-file*
Note: When the 'write' option is off, you are not able to write any file.
*:w* *:write*
*E502* *E503*