Closed hallzy closed 9 years ago
ah yes... line 243 should be
au BufWritePre * :call <SID>RemoveTrailingWhitespaces()
in my .vimrc I have the function called MyFormattingSubs because I have some substitutions that also make formatting changes such as, if I have:
if(x){
it would be changed to if (x) {
So yes, that was a copy paste error. I can fix it later if you want, or you can fix it... either way.
The pull request has been updated with the fixed typo.
hey @hallzy thanks! looks like there is a small bug tho. Just tried it out.
Error detected while processing function <SNR>2_RemoveTrailingWhitespaces:
E121: Undefined variable: _s
Wow I am on a roll. It was another copy/paste error. Just fixed it.
:) awesome. Will merge back in soon
Just noticed that the change is not part of this pull request. Does it need to be reopened to find the new change?
I think you need to open a new PR.
By putting the substitution that you had before into this function, when the function is called it will also save your current cursor position before the substitution is made. This way, after a substitution is made on a save your cursor will not be at the bottom of the file where the last substitution was made.
I also have:
instead of:
Because I like to remove trailing whitespace from all files I save with vim, not just ruby files. But if you prefer to only have that take effect in ruby files then that line can be changed to reflect that.