editorconfig: fix trim_trailing_whitespace

also trim all superfluous newlines at end-of-file if `trim_trailing_whitespace` is set
This commit is contained in:
jhalmen 2021-01-12 15:45:39 +01:00 committed by GitHub
parent df7b33bc7b
commit 33f44f6abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,7 +47,7 @@ define-command editorconfig-load -params ..1 -docstring "editorconfig-load [file
print "set-option buffer BOM utf8" print "set-option buffer BOM utf8"
} }
if (trim_trailing_whitespace == "true") { if (trim_trailing_whitespace == "true") {
print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{ %s\\h+$<ret>d } } }" print "hook buffer BufWritePre \"" file "\" -group editorconfig-hooks %{ try %{ execute-keys -draft %{ %s\\h+$|\\n+\\z<ret>d } } }"
} }
if (max_line_length && max_line_length != "off") { if (max_line_length && max_line_length != "off") {
print "set window autowrap_column " max_line_length print "set window autowrap_column " max_line_length