Call setl [no]endofline using insert_final_newline #197
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I use
:r testname.out
to read the lines of a file (where testname.out has no trailing newline)into the end of a file or replace the end of a file (e.g. testname.phpt with
--EXPECT--
or--OUTPUT--
sections), and thebinary
option was set(I think I set that years ago for php files,
for editing tests containing binary non-utf8 data?as a workaround to avoid diff noise when changing newlines in files in existing projects with no coding standards. This predated vim's support for fixendofline.),the resulting file has no newline when saving without
setl endofline
.EDIT: In the vast majority of use cases, enabling endofline for modern vim and overriding the binary setting seems like a mistake (e.g. most users would be opening binary file formats). I had
au FileType php setlocal binary
set years ago and should remove that.(This is checked outside of exists('+fixendofline'), to also work in older vim releases)
Alternative to #174