Is it possible to remove trailing whitespace automatically on save in IntelliJ IDEA? I know there are some workarounds, for example, using git to trim the whitespace on commit. Maybe this question is a duplicate of this one, but i hope this can be done without setting up keyboard shortcuts and macros.
相关问题
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Configure gradle plugin based on future tasks
- How to make available “open this project in Intell
- Emacs shell: save commit message
相关文章
- 请教Git如何克隆本地库?
- In IntelliJ IDEA, how can I create a key binding t
- IntelliJ IDEA can't open projects or add SDK o
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
Add an external tool. As the Program pass
/usr/bin/sed
(may be different on your box, runwhich sed
to locate) and insert the-i 's/[[:space:]]\+$//' $FilePath$
in the Parameters. Overall the command that you want IntelliJ to run is,This sed will remove the trailing whitespace, and overall the effect will be very similar to git. Next you can add a keyboard shortcut for your new external tool entry, but I am not sure whether it is possible to run anything on save.
Don't know about 12, but there's the following setting in 13:
Settings → Editor → Strip trailing spaces on Save
As of IntelliJ 2017.2 it's under
Settings → Editor → General → Strip trailing spaces on Save