Sublime Forum

Delete whitespace at the end of the line

#1

I am having unpredictable behaviour when deleting whitespace at the end of a line, that stems from deleting word separators.

Here are my word separators

"word_separators": " )./\\()\"'-:,.;<>~!@#$%^&*|+=]{}`~?	"

if I have contiguous word separator characters, pressing ctrl+backspace will delete ALL of the contiguous word separators until it hits a non word separator. This creates an annoying behavior when deleting whitespace at the end of a line. This is because it deletes all the blankspace characters, and any word separator characters behind it.

So in this example it will delete the 4 whitespace characters, but it also deletes the ‘;’ character.

someword;   

So when using ctrl+del or ctrl+backspace, sublime treats contiguous strings of word separator characters as a single word for deletion.

So my concluding question is as follows…

Is there a way to have sublime ctrl+del and ctrl+backspace treat only strings of the SAME word separators as a single word for deletion, instead of any combination of wordseparator characters.

0 Likes

#2

Anyone have a solution to this?

0 Likes

#3

I can not reproduce this, neither with the default nor your “word_separators” setting (which has some duplicates btw).

0 Likes

#4

Oh, I have made a mistake. I have a macro that I got from a forum somewhere mapped to ctrl+backspace.

I have this macro because I want to delete subwords, not whole words.

[code]
{
“command”: “move”,
“args”: {
“by”: “subwords”,
“extend”: true,
“forward”: false
}

},
{
“args”: null,
“command”: “left_delete”
}
][/code]

So it selects and then deletes. Is there a way to make the select behavior of sublime not extend past contiguous white space?

0 Likes

#5

move has many arguments, just try fiddling with them: docs.sublimetext.info/en/latest/ … mands.html (list not necessarily complete)

0 Likes