Note: When the 'write' option is off, you are not able to write any file.
*:w* *:write* *E502* *E503* *E504* *E505* *E512* *E514* *E667* *E949* :w[rite] [++opt] Write the whole bufferto the current file. This is the normal way to save changes to a file. Fails when 'readonly' is set orwhen there is another reason why the file can't be written, such as when the parent directory doesn't exist (use |++p| to avoid that). For ++opt see |++opt|, but only ++p, ++bin, ++nobin, ++ff and ++enc are effective.
:w[rite]! [++opt] Like ":write", but forcefully write when'readonly' is set or there is another reason why writing was refused. Note: This may change the permission and ownership of the fileand break (symbolic) links. Add the 'W' flag to'cpoptions' to avoid this.
:[range]w[rite][!] [++opt] Write the specified lines to the current file. This is unusual, because the file will not contain all lines in the buffer.
The [++opt] argument can be used tosetsomeoptionsfor one command, andto specify the behavior for bad characters. The form is: > ++{optname} Or: > ++{optname}={value}
Where {optname} is one of: *++ff* *++enc* *++bin* *++nobin* *++edit* ff or fileformat overrides 'fileformat' enc orencoding overrides 'fileencoding' bin or binary sets 'binary' nobin or nobinary resets 'binary' bad specifies behavior for bad characters edit for |:read|: keeps optionsasif editing a file p for |:write|: creates the file's parent directory
{value} cannot contain whitespace. It can be any valid value for the options. Examples: > :e ++ff=unix This edits the same file again with 'fileformat' set to "unix". >
:w ++enc=latin1 newfile This writes the current buffer to "newfile" in latin1 format.
The message given when writing a file will show "[converted]" when 'fileencoding' or the value specified with ++enc differs from 'encoding'.
There may be several ++opt arguments, separated by whitespace. They must all appear before any |+cmd| argument.