without an argument and then doing ":read file" to start
editing a file.
When the file name was set and 'filetype' is empty the filetype detection
autocommands will be triggered.
*not-edited*
Because the file name was set without really starting to edit that file, you
are protected from overwriting that file. This is done by setting the
"notedited" flag. You can see if this flag is set with the CTRL-G or ":file"
command. It will include "[Not edited]" when the "notedited" flag is set.
When writing the buffer to the current file name (with ":w!"), the "notedited"
flag is reset.
*abandon*
Vim remembers whether you have changed the buffer. You are protected from
losing the changes you made. If you try to quit without writing, or want to
start editing another file, Vim will refuse this. In order to overrule this
protection, add a '!' to the command. The changes will then be lost. For
example: ":q" will not work if the buffer was changed, but ":q!" will. To see
whether the buffer was changed use the "CTRL-G" command. The message includes
the string "[Modified]" if the buffer has been changed, or "+" if the 'm' flag
is in 'shortmess'.
If you want to automatically save the changes without asking, switch on the
'autowriteall' option. 'autowrite' is the associated Vi-compatible option
that does not work for all commands.
If you want to keep the changed buffer without saving it, switch on the
'hidden' option. See |hidden-buffer|. Some commands work like this even when
'hidden' is not set, check the help for the command.
==============================================================================
2. Editing a file *edit-a-file*
*:e* *:edit* *reload*
:e[dit][!] [++opt] [+cmd]
Edit the current file. This is useful to re-edit the
current file, when it has been changed outside of Vim.
*:edit!* *discard*
If [!] is given, unsaved changes in the current buffer
are discarded. Without [!] the command fails if there
are unsaved changes, unless 'autowriteall' is set and
the file can be written.
Also see |++opt| and |+cmd|.
*:edit_f*
:e[dit][!] [++opt] [+cmd] {file}
Edit {file}.
*:edit!_f*
If [!] is given, unsaved changes in the current buffer
are discarded. Without [!] the command fails if there
are unsaved changes, unless 'hidden' is set or
'autowriteall' is set and the file can be written.
Also see |++opt| and |+cmd|.
*:edit_#* *:e#*
:e[dit] [++opt] [+cmd] #[count]
Edit the [count]th buffer (as shown by |:files|).
This command does the same as [count] CTRL-^. But ":e
#" doesn't work if the alternate buffer doesn't have a
file name, while CTRL-^ still works then.
Also see |++opt| and |+cmd|.
*:ene* *:enew*
:ene[w] Edit a new, unnamed buffer. This fails when changes
have been made to the current buffer, unless 'hidden'
is set or 'autowriteall' is set and the file can be
written.
If 'fileformats' is not empty, the first format given
will be used for the new buffer. If 'fileformats' is
empty, the 'fileformat' of the current buffer is used.
*:ene!* *:enew!*
:ene[w]! Edit a new, unnamed buffer. Discard any changes to
the current buffer.
Set 'fileformat' like |:enew|.
*:fin* *:find*
:fin[d][!] [++opt] [+cmd] {file}
Find {file} in 'path' and then |:edit| it.
:{count}fin[d][!] [++opt] [+cmd] {file}
Just like ":find", but use the {count} match in
'path'. Thus ":2find file" will find the second
"file" found in 'path'. When there are fewer matches
for the file in 'path' than asked for, you get an
error message.
*:ex*
:ex [++opt] [+cmd] [file]
Same as |:edit|.
*:vi* *:visual*
:vi[sual][!] [++opt] [+cmd] [file]
When used in Ex mode: Leave |Ex-mode|, go back to
Normal mode. Otherwise same as |:edit|.
*:vie* *:view*
:vie[w][!] [++opt] [+cmd] file
When used in Ex mode: Leave |Ex-mode|, go back to
Normal mode. Otherwise same