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
  • 4 years ago
  • 3 days ago
  • 4 years ago

Installs

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

Readme

Source
raw.​githubusercontent.​com

Sublime Text - reindent on save

screenshot

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”