How can Sublime Text show non printable characters (I'm interested in SPACEs and TABs)?
10 Answers
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.
-
2Is there any way to change the color of white space (dash for tabs) to a little more light? Feb 15, 2013 at 13:20
-
3@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. Feb 18, 2013 at 10:06
-
2At 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.– Roger_SAug 26, 2013 at 15:35
-
2why not remove the color scheme stuff? thanks and upvote anyway! :D Jul 16, 2015 at 8:15
-
18There's no way to just toggle this from a menu?? Even the simplest text editors have this "feature".– CiriNov 26, 2015 at 11:22
In selected text, Space is shown as a middle dot (·
) and Tab as a long dash (—
).
-
6
-
28Which of course makes <kbd>Ctrl/Cmd+A</kbd> the fastest way of checking whitespace problems.– ionoJul 11, 2013 at 5:03
-
-
1This 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! Dec 2, 2021 at 23:28 -
I use Unicode Character Highlighter
, can show whitespaces and some other special characters.
Add this by, Package Control
Install packages, unicode ...
-
It will show up automatically if it finds some of special characters it can detects.– 5uloFeb 20, 2014 at 20:53
If you really only want to see trailing spaces, this ST2 plugin will do the trick: https://github.com/SublimeText/TrailingSpaces
-
-
1I love these little plugins. Super-alt-w highlights spaces in pink. Thanks!– staglJan 30, 2013 at 21:25
If you want to be able to toggle the display of whitespaces on and off, you can install the HighlightWhitespaces plugin
-
-
1Works fine in Sublime 3, too. Toggle the Whitespace view with Control-Alt-W.– SuzanaOct 13, 2016 at 12:13
Here is an Official tutorial of how to do that!
http://sublimetexttips.com/show-whitespace-sublime-text/
just like this!
Hope help for you!
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 :)
-
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
:-)
.– halferMar 8, 2016 at 20:23
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.
-
Actually "\s" is for all whitespace. For space only, escape the space character, "\ "– eldorzSep 1, 2019 at 23:12
http://sublimetexttips.com/show-whitespace-sublime-text/
- open
Ctrl+Shift+P
- search
Preferences: Settings –> User
- just paste below codes
{
"draw_white_space": "all",
"translate_tabs_to_spaces": true
}
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]"
}
-
-
...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– ptimJul 18, 2016 at 7:07