All text files should end with a terminating newline. This is a rule defined in the POSIX standard.
The built-in package atom/whitespace takes care of this. Make sure it's enabled in your package settings. See this image for some recommended settings, which should already be default on new Atom installations.
Add these settings to your configuration:
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true
There's nothing to do here. It's enabled by default. To verify this, run :echo &fixeol
and it should give you 1
.
This should be on for most file types in Spacemacs, but some file types don't have it, eg, .tool-versions
and Dockerfile
. Enable these settings in your Spacemacs config (usually ~/.spacemacs
or ~/.spacemacs.d/init.el
). Put them in the user-config section.
;; Under (defun docspacemacs/user-config ()...
(setq
mode-require-final-newline t
require-final-newline t)