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

Whitespace

by randy3k ST2/ST3

Remove Trailing Whitespace for Sublime Text

Details

Installs

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

Readme

Source
raw.​githubusercontent.​com

Whitespace

Sublime Text has options trim_trailing_white_space_on_save and ensure_newline_at_eof_on_save to handle whitespace. In some situations, these options do not give satisfactory result. While similar packages exist, e.g., TrailSpaces, they do not allow easier syntax specific settings. Whitespace helps in keeping your code clean by providing more features in removing trailing spaces.

  • remove trailing whitespace
  • ensure single trailing newline
  • ignore whitespace only lines
  • ignore whitespace on current line

Installation

This plugin can be installed via package control.

Options

  • The easiest way to apply “remove trailing whitespace” is by Command Palette C+Shift+P.

  • To activate “remove trailing whitespace on save”, click the menu items in Edit -> Whitespace.

  • To enable Whitespace at startup, modify your preference setting file. If you want to enable Whitespace for a specific syntax, edit Preferences -> Settings - More -> Syntax Specific:

{
    "remove_trailing_whitespace_on_save": true,
    "ensure_single_trailing_newline": true,
    "ignore_whitespace_only_lines": false,
    "ignore_whitespace_on_current_line": true
}

The options explain themselves. Their default values are false. You can also make use of Syntax Manager to enable Whitespace for multiple syntaxes.