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

Reindent on save

by mac2000 ST2/ST3 Trending

Sublime Text - reindent on save

Details

  • 2014.06.26.07.14.44
  • github.​com
  • github.​com
  • 5 years ago
  • 3 hours ago
  • 5 years ago

Installs

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

Readme

Source
raw.​githubusercontent.​com

Sublime Text - reindent on save

This is simple plugin to call reindent each time you save your file.

What you should be aware is that sublime's reindent is not perfect.

You can specify file types which you want to be reindented on save:

"reindent_on_save": ["css", "SCSS", "html", "Js"]

Installation

The recommended installation method is via Package Control. Learn more here: https://sublime.wbond.net/.

How to add configuration option

In your Sublime navigate to Preferences \ Settings - User

Your settings file will be opened.

In fresh installation of Sublime it probably will be something like this:

{
    "ignored_packages": ["Vintage"]
}

Or if you have made some changes, they will be saved here, in my case I had something like this:

{
    "color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
    "convert_tabspaces_on_save": true,
    "default_line_ending": "unix",
    "draw_white_space": "all",
    "ensure_newline_at_eof_on_save": true,
    "font_size": 14,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "ignored_packages": ["Vintage"],
    "rulers": [80, 120],
    "show_encoding": true,
    "show_line_endings": true,
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "word_wrap": false
}

To add new options, just place comma after last option and add new one, here is what it will look like in fresh installation:

{
    "ignored_packages": ["Vintage"],
    "reindent_on_save": ["php", "sublime-settings", "json", "html", "css"]
}

That is important to not forget add comma, or sublime will fail saving changes, and show you error message “Error trying to parse settings: Unexpected character, expected a comma”