Code Monkey home page Code Monkey logo

trimmer's Introduction

Trimmer

Travis CI Build Status AppVeyor Build status SonarQube Quality Gate Status Package Control Installs Latest Release

Trimmer is a Sublime Text plug-in for cleaning up whitespace.

Features

  • 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.
  • Trim whitespace from selection(s).
  • Delete empty, whitespace only lines.
  • Collapse multiple consecutive empty lines into one empty line.
  • Collapse multiple consecutive spaces into one space.
  • Trim empty, whitespace only lines at the beginning and end of file.
  • Remove blank space characters.
  • Normalize spaces (consecutive spaces reduced, empty lines removed and lines trimmed).
  • Tokenize a string by collapsing consecutive spaces, and trimming leading and trailing spaces.
  • Delete empty, whitespace only HTML and XML tags.
  • Remove code comments and collapse lines.

Additional Features

A Replace Smart Characters command that performs the following actions:

  • Smart single quotes: to '
  • Smart double quotes: to "
  • Prime: to '
  • Double Prime: to "
  • German quotes: to " and to '
  • Ellipsis: to ...
  • Em dash: to ---
  • En dash: to --
  • Bullet: to *
  • Middle dot: · to -
  • Em space to three spaces
  • En space to two spaces
  • Non-breaking space to one space
  • Thin space to one space
  • Hair space to one space
  • Left angle quote: « to <<
  • Right angle quote: » to >>
  • Copyright symbol: © to (C)
  • Trademark symbol: to (T)
  • Registered trademark symbol: ® to (R)

ScreenShot

Watch a Quick Demo

Installation

By Package Control

  1. Download & Install Sublime Text 3 (https://www.sublimetext.com/3)
  2. Go to the menu Tools -> Install Package Control, then, wait few seconds until the installation finishes up
  3. Now, Go to the menu Preferences -> Package Control
  4. Type Add Channel on the opened quick panel and press Enter
  5. Then, input the following address and press Enter
    https://raw.githubusercontent.com/evandrocoan/StudioChannel/master/channel.json
    
  6. Go to the menu Tools -> Command Palette... (Ctrl+Shift+P)
  7. Type Preferences: Package Control Settings – User on the opened quick panel and press Enter
  8. Then, find the following setting on your Package Control.sublime-settings file:
    "channels":
    [
        "https://packagecontrol.io/channel_v3.json",
        "https://raw.githubusercontent.com/evandrocoan/StudioChannel/master/channel.json",
    ],
  9. And, change it to the following, i.e., put the https://raw.githubusercontent... line as first:
    "channels":
    [
        "https://raw.githubusercontent.com/evandrocoan/StudioChannel/master/channel.json",
        "https://packagecontrol.io/channel_v3.json",
    ],
    • The https://raw.githubusercontent... line must to be added before the https://packagecontrol.io... one, otherwise, you will not install this forked version of the package, but the original available on the Package Control default channel https://packagecontrol.io...
  10. Now, go to the menu Preferences -> Package Control
  11. Type Install Package on the opened quick panel and press Enter
  12. Then, search for Trimmer and press Enter

See also:

  1. ITE - Integrated Toolset Environment
  2. Package control docs for details.

Usage

All commands are accessible from the Command Palette using prefix Trimmer, and in the Main Menu under Edit -> Line -> Trimmer command.

Key Bindings

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

Trimmer Command API

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 selection, or entire file
trim_leading_trailing_whitespace trim whitespace at the start and end of each line selection, or entire file
trim_selections trim whitespace from selection(s) selection
delete_empty_lines delete empty, whitespace only lines selection, or entire file
collapse_lines collapse multiple consecutive empty lines into one empty line selection, or entire file
collapse_spaces collapse multiple consecutive spaces into one space selection, or entire file
trim_edges trim empty, whitespace only lines at the beginning and end of the file entire file
remove_blank_spaces remove all blank space characters (tab, cr, ff, vt, space) selection, or entire file
normalize_spaces consecutive spaces reduced, empty lines removed and lines trimmed selection, or entire file
replace_smart_characters replace smart characters (smart quotes, em/en dash, ellipsis, nbsp) selection, or entire file
tokenize_string convert a string to a token by collapsing consecutive spaces, and trimming leading and trailing spaces selection, or entire file
delete_empty_tags delete empty, whitespace only html and xml tags selection, or entire file
remove_comments remove code comments and collapse lines selection, or entire file

Author

Jon LaBelle

License

Trimmer is licensed under the MIT license.

trimmer's People

Contributors

jonlabelle avatar evandrocoan avatar loquillo avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.