From f690b551729e9e44fe27bdf17138f782e5832f01 Mon Sep 17 00:00:00 2001 From: Tyson Andre Date: Sun, 23 Oct 2022 10:58:37 -0400 Subject: [PATCH] Call setl [no]endofline using insert_final_newline 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), the resulting file has no newline when saving without `setl endofline`. (This is checked outside of exists('+fixendofline'), to also work in older vim releases) --- plugin/editorconfig.vim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugin/editorconfig.vim b/plugin/editorconfig.vim index d0deb265..be53703f 100644 --- a/plugin/editorconfig.vim +++ b/plugin/editorconfig.vim @@ -445,6 +445,11 @@ function! s:ApplyConfig(config) abort " Set the buffer options {{{1 augroup END if s:IsRuleActive('insert_final_newline', a:config) + if a:config["insert_final_newline"] == "false" + setl noendofline + else + setl endofline + endif if exists('+fixendofline') if a:config["insert_final_newline"] == "false" setl nofixendofline