Trimmer is a Sublime Text plug-in for cleaning up whitespace.
- Trim whitespace at the end of each line.
- Trim whitespace at the start of each line.
- Trim whitespace at the start and end of each line.
- Delete empty, whitespace only lines.
Trimmer is compatible with both Sublime Text 2 and Sublime Text 3, on all OS platforms (OS X, Windows and Linux).
If you have Package Control installed, simply navigate to:
- Tools
- Command Palette...
- Package Control: Install Package
- type the word
Trimmer
- type the word
To install Trimmer using Git, change to your Sublime Text Packages directory, and clone the Trimmer repository.
# on OS X... cd to your Packages directory and clone the Git repository
cd ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/ &&
git clone https://github.com/jonlabelle/TrimmerYou can also manually install Trimmer.
Download and extract the zip file to your Packages directory. Listed below are the default Sublime Text Packages directories by platform.
# OS X
~/Library/Application Support/Sublime Text [2|3]/Packages
# Linux
~/.Sublime Text [2|3]/Packages
# Windows
%APPDATA%/Sublime Text [2|3]/PackagesNOTE: replace the
[2|3]part above with the appropriate Sublime Text major version of your install.
The default key binding will trim trailing whitespace at the end of each of line (entire file).
- OS X:
Ctrl + S - Linux:
Ctrl + Alt + S - Windows:
Ctrl + Alt + S
All commands are accessible from the Command Palette and prefixed with Trimmer:.
| command | description | context |
|---|---|---|
trimmer |
trim whitespace at the end of each line | entire file |
trim_leading_whitespace |
trim whitespace at the start of each line | selected lines, or entire file |
trim_leading_trailing_whitespace |
trim whitespace at the start and end of each line | selected lines, or entire file |
delete_empty_lines |
delete empty, whitespace only lines | selected lines, or entire file |