helix
helix copied to clipboard
Toggle to enforce a newline at the end of a document
I suggest adding a toggle eol to enforce a newline at the end of a document.
I wonder if editorconfig can help enforce it? #279
It might be worth mentioning that this is also already unconditionally enforced by rustfmt (:fmt?). So if #279 is implemented/merged, we'd have at least 2 features which enforce this, and this new option would be a third one...
this new option would be a third one
I think that there are quite a few cases where such option would provide value, being any where rustfmt or editorconfig isn't available/applicable/redundant.
An example would be editing a simple text file, or a simple script whete I don't want to add an entire editorconfig.
Yes. It would also nice to have a config setting that specifies whether helix should insert a newline at end of file if none exists whenever saving a file (regardless of which language the file is in).
And another config setting to always remove trailing whitespace on save.
Sublime Text has both config settings.
Found this because I have the same predicament. Never had the issue in vim, and vscode comes with a config file.insertFinalNewline because they also don't do it by default.
I think this would be a great addition as well. It looks like there was a pull request linked above that seemed almost ready to merge that has since been closed. Any way that could be reopened to continue the work?
As it was closed, it's probably better for someone to open a new pr to continue the work. Unless the original author comes back and wants to finish it, but in the meantime it should be ok for someone else to pick it up.
I think having a .editorconfig in the /home/user directory would be the better or more generic approach.