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

Reindent on save

by mac2000 ST2/ST3

Sublime Text - reindent on save

Details

  • 2014.06.26.07.14.44
  • github.​com
  • github.​com
  • 5 years ago
  • 1 hour ago
  • 5 years ago

Installs

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