ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Highlight Whitespaces

by disq ST2/ST3

Highlight whitespaces in code. Separate colors for tabs and spaces.

Details

Installs

  • Total 19K
  • Win 8K
  • OS X 8K
  • Linux 4K
Oct 20 Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5
Windows 0 7 8 5 7 2 2 4 6 2 3 5 2 2 8 2 5 9 6 1 5 10 11 7 11 4 5 7 23 8 4 8 4 3 2 6 14 11 5 4 3 0 3 2 4 3
OS X 0 1 4 3 4 0 2 2 2 1 1 1 0 2 5 4 2 6 3 2 4 3 6 6 2 3 3 3 5 4 7 1 5 3 4 6 10 4 4 7 5 2 3 5 2 1
Linux 0 3 4 4 2 3 0 2 5 0 1 3 0 4 2 3 2 3 2 0 0 2 3 4 0 1 0 1 2 6 5 3 3 0 1 6 5 5 2 2 0 0 1 2 4 4

Readme

Source
raw.​githubusercontent.​com

Synopsis

This is a plugin for Sublime Text 2 and 3.

Highlight whitespaces in documents

This plugin will highlight each tab or more-than-one space in the document.

Installation

Go to your Packages subdirectory under ST2's data directory:

  • Windows: %APPDATA%\Sublime Text 2
  • OS X: ~/Library/Application Support/Sublime Text 2/Packages
  • Linux: ~/.config/sublime-text-2/Packages
  • Portable Installation: Sublime Text 2/Data

Then clone this repository:

git clone git://github.com/disq/HighlightWhitespaces.git

That's it!

Note for ST3 users: For Sublime Text 3, replace “2” with “3” in path names. (%APPDATA%\Sublime Text 3 and so on)

Options

Several options are available to customize the plugin look 'n feel. The config keys goes into config files accessible throught the “Preferences” menu.

Toggle highlight shortcut

The default toggle highlight shortcut is ctrl+alt+w (cmd+alt+w for OS X)

Disable highlighting when Sublime Text starts up

Change highlight_whitespaces_enabled from the default of true to false.

Change the highlighting color

One may also change the highlighting color, providing a scope name such as “invalid”, “comment”… in “File Settings - User”:

{
    "highlight_whitespaces_space_highlight_scope_name": "invalid",
    "highlight_whitespaces_tab_highlight_scope_name": "invalid",
    "highlight_whitespaces_eol_highlight_scope_name": "invalid",
    "highlight_whitespaces_mixed_highlight_scope_name": "invalid"
}

Actually, “invalid” is the default value. If you'd like to use a custom color, it should be defined as a color scope in your theme file. Feel free to ask me how to do it.

Disabling highlighting for large files

Highlighting may be disabled for large files. The default threshold is around 1M chars. This is configurable (in “File Settings - User”); unit is number of chars:

{ "highlight_whitespaces_file_max_size": 1000}

Credits

This is a modified version of the TrailingSpaces plugin by Jean-Denis Vauguet and Oktay Acikalin

TrailingSpaces is at https://github.com/SublimeText/TrailingSpaces/