Skip to Content

Sublime Text - Quick Indicator for Tabs vs. Spaces

I was running through some code today in JSHint and it was complaining about “Mixed spaces and tabs.”

What? I always use tabs so I was curious where the spaces where… Sure enough on looking there were spaces! Doh.

Then I noticed something in Sublime:

Sublime - Tabs and Spaces

Do you see it?

Before ‘displayStipulator’ there is ‘….—-’ and before ‘doChanged’ it’s ‘—-….’. When selecting text in Sublime the tabs ‘—-’ and spaces ‘….’ are highlighted for you!

Now that I know this is there I’ll be more aware and cleanup spaces when I see them!

Update: Digging through the preferences, there is an option for this:

// Set to "none" to turn off drawing white space, "selection" to draw only the
// white space within the selection, and "all" to draw all white space
"draw_white_space": "all",

Also note you can easily convert from one to the other via View > Indentation > Convert