New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
automatically clean up lines that I type, but not others #8
Comments
This is an interesting feature. I'm afraid I don't have the time to work on this right now but I'll consider it when I have the time. |
I propose renaming the current command to like "delete trailing spaces in file" and adding a new command with the old name and said behaviour, only considering selected lines or those with selection in them. |
We can't blindly rename the command for users did set mappings to it. I think the ultimate level of flexibility would be to allow users to specify which behavior they expect based on the file type (this would solve several issues/feature requests at once), with some sensible defaults. |
Okay, that's actually an issue, didn't think about that. You could notify users using Package Control update messages but still, everyone would have to rename his possible key bindings or whatever. I just thought that it would be a nice default behaviour. Well, analog to that, a "delete trailing spaces in selection" command should work wonders. For ultimate flexibility, add a setting which specifies a scope selector which then specifies when to use the selection command by default. This is probably the easiest way to code if it's actually needed and does not hurt if it remains untouched. |
I would really like to see this option for Sublime. It is available in RubyMine for example: |
@webwurst I don't know yet if ST provides a way to monitor "modified lines" only in easy way, apart from the "recent changes" buffer (in which case the trailing spaces deletion would probably occur on the fly, not upon saving). I'll look into that and try to figure out a way to do this, this is a really handy feature! |
You can perform diffs like the default implementation in the Default package. Edit: "diff_changes" command. |
@FichteFoll thanks for this hint. I guess I can use difflib to get back to the line numbers of the edited lines with respect to what diff_changes consider to be the diff (aka. since last save for dirty, already saved documents), so this should not be too much of a pain. Feature planned! |
@glyph @FichteFoll @webwurst #36 implements the Modified Lines Only feature. I think this is pretty close to this feature request, and the behavior of trimming left-over trailing spaces upon pressing Enter is handled by Sublime Text as well. I'm therefore closing this issue! Hope you'll enjoy the new features from v1.0.0. |
If I'm editing a file, I don't want to add new trailing whitespace, but I also don't want to be submitting massive diffs that clean up all the whitespace in a big file while I'm making an unrelated change.
So when I type "return return ", I want to automatically clean up the whitespace that's left behind, but I don't want to use the "nuclear option" of "delete trailing spaces", since that's going to affect lots of lines I didn't write.
A good start on this would be for "delete trailing spaces" to only work on selected lines, if there's an active selection.
The text was updated successfully, but these errors were encountered: