From 33f44f6abcd758977e346adb91b991c003725281 Mon Sep 17 00:00:00 2001 From: jhalmen Date: Tue, 12 Jan 2021 15:45:39 +0100 Subject: [PATCH] editorconfig: fix trim_trailing_whitespace also trim all superfluous newlines at end-of-file if `trim_trailing_whitespace` is set --- rc/detection/editorconfig.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/detection/editorconfig.kak b/rc/detection/editorconfig.kak index c28e3696..0e78f7c5 100644 --- a/rc/detection/editorconfig.kak +++ b/rc/detection/editorconfig.kak @@ -47,7 +47,7 @@ define-command editorconfig-load -params ..1 -docstring "editorconfig-load [file print "set-option buffer BOM utf8" } if (trim_trailing_whitespace == "true") { - print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{ %s\\h+$d } } }" + print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{ %s\\h+$|\\n+\\zd } } }" } if (max_line_length && max_line_length != "off") { print "set window autowrap_column " max_line_length