How do I actually trim trailing whitespace?

Answered

I have tried the following:


1. "Strip trailing spaces on Save" = "All" and "Allow placement of caret after end of line" off.

- Doesn't work: https://www.youtube.com/watch?v=mChERGVl9Xo&feature=youtu.be

2. "Strip trailing spaces on Save" = "All" and "Allow placement of caret after end of line" on.

- Doesn't work, same as video above

3. Recording a macro to find `[ ]+$` and replace all

- Macro seems to use "replace" instead of "replace all", or maybe it didn't record that I selected "regex" checkbox

4. Configuring an "external tool" `sed -i '' -E 's/[ ]+$//g' $FilePath$`

- My sed command works on command line, fails in rubymine with:


```

/usr/bin/sed -i '' -E 's/[ ]+$//g' /Users/jared/redacted/README.md
sed: 1: "'s/[": invalid command code '

```


Maybe rubymine is putting double quotes around the pattern parameter.


I've spent over an hour trying to get this simple feature to work, so please tell me there's a way to actually strip trailing whitespace in rubymine.



Attachment(s):
Screen Shot 2015-08-26 at 2.25.17 PM.png
2 comments

Hi,

for me both #1 and #2 works, to verify this I'd suggest to turn "show whitespace" option on (Settings|Editor|General|Appearance).
Also the problem can be caused by one of installed plugins.  I'm using markdown plugin from Jetbrains and everything works ok.

Hope this help, Oleg.

0

An extension indeed might cause a problem. I had to configure Vim Emulator Ctrl+S mapping in Rider to be handled by IDE instead of the extension.

0

Please sign in to leave a comment.