Last active
August 10, 2020 10:31
-
-
Save jandudulski/4451806 to your computer and use it in GitHub Desktop.
How to configure your editor to automatically strip trailing whitespaces and keep new line at the end of file?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if has("autocmd") | |
" remove trailing white spaces | |
autocmd BufWritePre * :%s/\s\+$//e | |
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Tools -> Options -> Editor -> On Save > Remove Trailing Whitespace From | |
* Select: All lines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to preferences / editor and check: | |
* Ensure line feed at file end on Save | |
* Strip trailing spaces on Save |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Trims white space added by auto_indent when moving the caret off the line. | |
"ensure_newline_at_eof_on_save": true, | |
"trim_automatic_white_space": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"files.insertFinalNewline": true, | |
"files.trimTrailingWhitespace": true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VS Code (
settings.json
)