Home Download Buy Blog Forum Support

Slightly different whitespace removal

Slightly different whitespace removal

Postby aarontav on Sun Dec 09, 2012 5:35 pm

I'm working on a large code base where whitespace removal is the norm, but they have a slightly different rule than whats used by 'trim_trailing_white_space_on_save'. They remove whitespace at the end of the line except where auto indent would have put in whitespace. So whitespace on empty lines between methods would retain their whitespace to preserve the same indent level. So if I have autoIndent on in a simple sense /\s+\Z/ , but not /\A\s+\Z/ .

Its a a pretty big problem, because my commits that might have a single line change actually have 30-40 changes (just hiding these with 'diff -w' is not enough because the commits include these changes).

Any thoughts on how I could do this? Is there a built in option or do I need to go digging into the existing plugin?
aarontav
 
Posts: 2
Joined: Sun Dec 09, 2012 5:17 pm

Re: Slightly different whitespace removal

Postby pier on Sun Dec 09, 2012 5:46 pm

I'm not an expert... but I'd say you will have to make a python script for that.

Here's an example on how to do something when saving:
https://github.com/alexnj/SublimeOnSave ... veBuild.py
pier
 
Posts: 92
Joined: Fri Jun 15, 2012 2:47 am

Re: Slightly different whitespace removal

Postby aarontav on Sun Dec 09, 2012 5:53 pm

I found an external plugin that does this, except it doesn't do it on save. It has an option called "trailing_spaces_include_empty_lines". Now I have two options that don't get me the full solution. If I could bolt this in to the existing functionality that would rock. ;)
aarontav
 
Posts: 2
Joined: Sun Dec 09, 2012 5:17 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 11 guests

cron