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

Whitespace

by randy3k ST2/ST3

Remove Trailing Whitespace for Sublime Text

Details

Installs

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

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.