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

更新时间:2020-07-05 11:15:17

Browse

Reindent on save

by mac2000 ALL

Sublime Text - reindent on save

Details

  • 2014.06.26.07.14.44
  • github.​com
  • github.​com
  • 6 years ago
  • 2 hours ago
  • 6 years ago

Installs

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

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”