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
  • 4 years ago
  • 34 minutes ago
  • 4 years ago

Installs

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

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”