diff options
author | K.Takata <kentkt@csc.jp> | 2022-11-01 20:36:19 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-01 20:36:19 +0000 |
commit | 3af982196b1b973e953c35351961f2a96fe34172 (patch) | |
tree | 8b2bc31d033187b17b4c5fb6e51350f833cd984b /runtime/doc/editing.txt | |
parent | 8e0ccb6bc21a446e5c6375b7fdf200fb53a129da (diff) |
patch 9.0.0826: if 'endofline' is set CTRL-Z may be written in a wrong placev9.0.0826
Problem: If 'endofline' is set the CTRL-Z may be written in the wrong
place.
Solution: Write CTRL-Z at the end of the file. Update the help to explain
the possibilities better. (Ken Takata, closes #11486)
Diffstat (limited to 'runtime/doc/editing.txt')
-rw-r--r-- | runtime/doc/editing.txt | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index 522831f992..e5661b1bb5 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -578,6 +578,43 @@ single <NL> characters are unexpectedly replaced with <CR><NL>. You can encrypt files that are written by setting the 'key' option. This provides some security against others reading your files. |encryption| +END OF LINE AND END OF FILE *eol-and-eof* + +Vim has several options to control the file format: + 'fileformat' the <EOL> style: Unix, DOS, Mac + 'endofline' whether the last line ends with a <EOL> + 'endooffile' whether the file ends with a CTRL-Z + 'fixendofline' whether to fix eol and eof + +The first three values are normally detected automatically when reading the +file and are used when writing the text to a file. While editing the buffer +it looks like every line has a line ending and the CTRL-Z isn't there (an +exception is when 'binary' is set, it works differently then). + +The 'fixendofline' option can be used to choose what to write. You can also +change the option values to write the file differently than how it was read. + +Here are some examples how to use them. + +If you want files in Unix format (every line NL terminated): > + setl ff=unix fixeol +You should probably do this on any Unix-like system. Also modern MS-Windows +systems tend to work well with this. It is recommended to always use this +format for Vim scripts. + +If you want to use an old MS-DOS file in a modern environment, fixing line +endings and dropping CTRL-Z, but keeping the <CR><NL> style <EOL>: > + setl ff=dos fixeol +This is useful for many MS-Windows programs, they regularly expect the +<CR><NL> line endings. + +If you want to drop the final <EOL> and add a final CTRL-Z (e.g. for an old +system like CP/M): > + setl ff=dos nofixeol noeol eof + +If you want to preserve the fileformat exactly as-is, including any final +<EOL> and final CTRL-Z: > + setl nofixeol ============================================================================== 3. The argument list *argument-list* *arglist* |