Sublime Forum

Trim trailing whitespace from block selection

#1

I saw that there is an option to trim trailing whitespace on save, but I can’t find an option to trim from a block selection. Is there another way to achieve this?

I copy from block selections frequently and then have to manually remove any trialing whitespace from uneven selections when I paste into a spreadsheet. It would be very handy if I could automate that somehow.

Thanks!

0 Likes

#2

Trim Trailing White Space is available from the command palette; it works on the file as a whole and not just the selection though, if that matters.

0 Likes

#3

I apologize, I should have been clearer.

I work on csv files and have them formatted in sublime using the Advanced CSV package to make this easier. It adds whitespace to help line up the columns. It’s when I make a selection from these columns that I pick up the unwanted whitespace.

I wouldn’t have even thought to ask about this, but I was setting up Windows Terminal and saw the option listed there and wondered if Sublime had it too and I just wasn’t seeing it.

It would certainly be a great timesaver for me, but I’m guessing there isn’t much call for it or it would already be a feature.

I guess I’ll consider making a feature request, but wanted to be certain I wasn’t overlooking a way to accomplish this first.

Thanks!

0 Likes

#4

Ahh yes, the built in command won’t do anything like that and there’s no built in functionality for that either. A plugin could do that fairly easily, presuming that the data is always comma separated as it is here.

I’m actually kind of surprised that Advanced CSV doesn’t have the ability to do that already since it’s the one putting the spaces there in the first place.

0 Likes

#5

Thanks for verifying it’s not already built in.

I decided to go ahead and make a formal feature request.

0 Likes