- Notifications
You must be signed in to change notification settings - Fork108
Newline at End of File Support
This property has already been added to the EditorConfig specification asinsert_final_newline
. This wiki page is only for archive purposes.
Aninsert_final_newline
option (or similarly named option) will control whether a newline is automatically inserted at the end of a file on save (when a newline is missing).
Understood values for this option will be:
true
: a newline will be inserted at the end of the file automaticallyfalse
: no newline will be inserted at the end of the file automatically
The options would betrue
andfalse
and would have the same behavior as described above for all of the below option names.
Names this option might have:
- insert_final_newline
- require_final_newline
- insert_newline_at_end_of_file
Default behavior:
- doesn't show the last newline at the end of the file
- automatically adds a newline when saving files
Automatic newline insertion can be disabled by enablingbinary file editing and disabling theendofline option. We may be able to usethis method of disabling newline insertion on write for the Vim plugin. One notable quirk with this method is that settingbinary
forces LF line endings so this method cannot be used for files with CRLF line endings which would probably be the most common case for this option.This vim tip on preserving missing newlines at end of file may help resolve this issue.
Default behavior:
- shows the last newline at the end of the file
- automatically adds a newline when saving files
Automatic newline insertion can be disabled by setting therequire-final-newline option tonil
.
Default behavior:
- doesn't show the last newline at the end of the file
- automatically adds a newline when saving files
Thisbehavior cannot be changed in Gedit currently. Gedit will not be able to support this option.
Default behavior:
- shows the last newline at the end of the file
- does not automatically add a newline when saving files
Default behavior:
- doesn't show the last newline at the end of the file if the file hada trailing newline when it was opened
- automatically adds a newline when saving for new files only(preserves missing newlines in existing files)
Default behavior:
- shows the last newline at the end of the file
- does not automatically add a newline when saving
Default behavior:
- Shows the last newline at the end of the file
- adds a newline if "Ensure newline at file end" is checked
Default behavior:
- Shows the last newline at the end of the file
- Does not add a newline when saving files by default
This behavior can be changed by setting theensure_newline_at_eof_on_save
option totrue
.
The wiki is disabled from public edits due to spams. If you would like to request a change in wiki, please open anew discussion.