467

How can Sublime Text show non printable characters (I'm interested in SPACEs and TABs)?

asked Apr 14, 2012 at 13:26

11 Answers 11

700

To view whitespace the setting is:

// 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": "selection",

You can see it if you go into Preferences->Settings Default. If you edit your user settings (Preferences->Settings - User) and add the line as per below, you should get what you want:

{
 "color_scheme": "Packages/Color Scheme - Default/Slush & Poppies.tmTheme",
 "font_size": 10,
 "draw_white_space": "all"
}

Remember the settings are JSON so no trailing commas.

answered Apr 14, 2012 at 13:29
Sign up to request clarification or add additional context in comments.

6 Comments

Is there any way to change the color of white space (dash for tabs) to a little more light?
@Mithun you should be able to edit the colour scheme to make that change. I'm not sure of the specific colour setting you would have to change, but they are labelled pretty sensibly so you should be able to find it with a bit of playing around.
At the beginning of a color scheme, you'll find general settings — background, caret, foreground, etc. The "invisibles" key is the color you want to change.
why not remove the color scheme stuff? thanks and upvote anyway! :D
There's no way to just toggle this from a menu?? Even the simplest text editors have this "feature".
|
98

In selected text, Space is shown as a middle dot (·) and Tab as a long dash ().

Gabriel Staples
56.1k35 gold badges299 silver badges394 bronze badges
answered Apr 19, 2012 at 8:11

5 Comments

unless you've set '"translate_tabs_to_spaces": true' ofcourse
Which of course makes <kbd>Ctrl/Cmd+A</kbd> the fastest way of checking whitespace problems.
This works on my linux laptop but doesn't on my windows desktop.
This is SO useful and easy to see! Just press Ctrl + A to select everything, and voilá! You magically see all the tab and space chars as you described!
Note that this also works in Sublime Text 3 and 4.
17

I use Unicode Character Highlighter, can show whitespaces and some other special characters.

Add this by, Package Control

Install packages, unicode ...

answered Aug 23, 2013 at 14:18

1 Comment

It will show up automatically if it finds some of special characters it can detects.
14

If you really only want to see trailing spaces, this ST2 plugin will do the trick: https://github.com/SublimeText/TrailingSpaces

answered Oct 3, 2012 at 7:38

2 Comments

pylinter will also do this.
I love these little plugins. Super-alt-w highlights spaces in pink. Thanks!
13

If you want to be able to toggle the display of whitespaces on and off, you can install the HighlightWhitespaces plugin

answered Jan 21, 2013 at 16:48

2 Comments

This feature was added in TrailingSpaces as well (just to note).
Works fine in Sublime 3, too. Toggle the Whitespace view with Control-Alt-W.
13

Here is an Official tutorial of how to do that!
http://sublimetexttips.com/show-whitespace-sublime-text/

just like this!

enter image description here
enter image description here

Hope help for you!

answered Oct 13, 2016 at 5:22

Comments

4

A "quick and dirty" way is to use the find function and activate regular expressions.

Then just search for : \s for highlighting spaces \t for tabs \n for new-lines etc.

answered Sep 22, 2015 at 19:23

1 Comment

Actually "\s" is for all whitespace. For space only, escape the space character, "\ "
4

I know this is an old thread, but I like my own plugin that can cycle through whitespace modes (none, selection, and all) via a single shortcut. It also provides menu items under a View | Whitespace menu.

Hopefully people will find this useful - it is used by a lot of people :)

halfer
20.2k20 gold badges110 silver badges207 bronze badges
answered Mar 8, 2016 at 20:09

1 Comment

This might be regarded as a link-only answer, or a response to a software recommendation, both of which are off-topic. However, it does seem to be helpful, so I'll leave it be :-).
3

http://sublimetexttips.com/show-whitespace-sublime-text/

  1. open

Ctrl+Shift+P

  1. search

Preferences: Settings –> User

  1. just paste below codes

{
 "draw_white_space": "all",
 "translate_tabs_to_spaces": true
}

answered Sep 19, 2017 at 1:48

Comments

1

I've several plugins (including Unicode Character Highlighter), but the only one which found the character that was hiding from me today was Highlighter.

You can test to see if it's working by pasting in the text from the readme.

For reference, the character causing me trouble was .

For a sanity check, tap your right arrow key over a range of text containing an invisible character, and you'll need to right-arrow twice to move past the character.

I'm also using the following custom regex string (which I don't fully grok):

{
 // there's an extra range in use [^\\x00-\\x7F]
 // also, don't highlight spaces at the end of the line (my settings take care of that)
 "highlighter_regex": "(\t+ +)|( +\t+)|[^\\x00-\\x7F]|[\u2026\u2018\u2019\u201c\u201d\u2013\u2014]"
}
answered Jul 18, 2016 at 6:14

2 Comments

btw.. this character was copied out of a Skitch > Zeplin workflow
...and whilst I think of it, as another sanity check is linux.die.net/man/1/xxd. On the terminal, type xxd, enter, then paste your string
0
  1. Open the preferences settings(Command+,)
  2. Add "draw_white_space": "add"

settings

answered Jan 5, 2023 at 7:27

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.