spacemacs

How can I configure Spacemacs to always add a newline at the end of files when saving?


I would like text files that I edit in Spacemacs to always end with a newline (\n) when I save them, even if I don't explicitly add it. How can I configure Spacemacs to do this?

I noticed this issue when created a file called .clangd with the contents

CompileFlags:
  Add: [-Isrc, -Isrc/effect]

When I wrote this file with :w, it did not have a newline at the end of the file.


Solution

  • (setq require-final-newline t)