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

Whitespace

by randy3k ST2/ST3

Remove Trailing Whitespace for Sublime Text

Details

Installs

  • Total 18K
  • Win 6K
  • 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 3 11 8 9 13 9 3 8 5 7 12 18 4 4 12 5 22 14 13 4 11 19 10 10 15 10 6 7 6 14 15 10 11 5 4 7 15 17 10 9 4 13 7 11 11 2
OS X 2 12 6 11 10 2 6 10 13 9 16 8 6 6 11 11 10 18 11 7 5 10 18 14 18 13 3 9 11 17 14 18 13 5 11 9 18 20 9 8 5 3 15 8 19 13
Linux 3 9 5 4 7 0 6 4 12 6 6 4 5 2 9 9 10 5 7 5 2 5 8 9 6 4 6 3 3 11 7 7 5 2 3 11 8 4 4 4 2 2 3 4 5 4

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.