-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toggle to enforce a newline at the end of a document #4274
Comments
I wonder if editorconfig can help enforce it? #279 |
Add an option (`eof`) to the config which should determine if files should end with EOF newline character or not. Update documentation of the book to detail the new flag as well. Closes: helix-editor#4274 Signed-off-by: Filip Dutescu <[email protected]>
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 |
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. |
This resolves helix-editor#4274 with the implementation largely based off of helix-editor#5435 and also addresses the review from @the-mikedavis on that PR. The option name is from EditorConfig's `insert_final_newline`, which is also used by VS Code as `files.insertFinalNewline`. We match Vim's behavior in that :w will add the newline to unmodified files but :wa will not; see helix-editor#1760. Co-authored by: Xalfer <[email protected]>
This resolves helix-editor#4274 with the implementation largely based off of helix-editor#5435 and also addresses the review from @the-mikedavis on that PR. The option name is from EditorConfig's `insert_final_newline`, which is also used by VS Code as `files.insertFinalNewline`. We match Vim's behavior in that :w will add the newline to unmodified files but :wa will not; see helix-editor#1760. Co-authored-by: Xalfer <[email protected]>
This resolves helix-editor#4274 with the implementation largely based off of helix-editor#5435 and also addresses the review from @the-mikedavis on that PR. The option name is from EditorConfig's `insert_final_newline`, which is also used by VS Code as `files.insertFinalNewline`. We match Vim's behavior in that :w will add the newline to unmodified files but :wa will not; see helix-editor#1760. Tests are included for this. Co-authored-by: Xalfer <[email protected]>
I suggest adding a toggle
eol
to enforce a newline at the end of a document.The text was updated successfully, but these errors were encountered: