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

Indentation Size Setting

by Kronuz ST3

Sublime Text 3 plugin for adding indent_size setting

Labels indent, tab, size, settings

Details

Installs

  • Total 2K
  • Win 998
  • Mac 371
  • Linux 347
Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 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
Windows 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
Mac 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0

Readme

Source
raw.​githubusercontent.​com

Indentation Size Setting

Sublime Text 3 Plugin To Add Indentation Size Setting

Synopsis

This plugin gives Sublime Text the ability to have different settings for tab width, indent size, indent type (spaces vs. tabs), so it correctly displays and properly indent old code, as requested in https://www.sublimetext.com/forum/viewtopic.php?f=4&t=15922.

Some codebases have indentation requirements that are unusual by today's standards, meaning they require Tab characters to be 8 spaces wide, but indentations to be 4 spaces.

This creates a problem with Sublime Text because while we can set the “tab_size” parameter to 8, it then causes all tab key presses to use 8 spaces as well. This is my attempt at resolving this issue. I decided to put this out there because from reading the forums and the userecho site for Sublime Text, there are at least a few other people out there in my shoes.

This plugin was inspired by Vimdentation (https://github.com/Wintaru/Vimdentation) but it has been tweaked and improved so it's more cleanly and transparently integrated with Sublime Text.

Installation

With the Package Control plugin: The easiest way to install IndentSize is through Package Control, which can be found at this site: http://wbond.net/sublime_packages/package_control

Once you install Package Control, restart Sublime Text and bring up the Command Palette (Command+Shift+P on OS X, Control+Shift+P on Linux/Windows). Select “Package Control: Install Package”, wait while Package Control fetches the latest package list, then select IndentSize when the list appears. The advantage of using this method is that Package Control will automatically keep IndentSize up to date with the latest version.

Without Git: Download the latest source from GitHub and copy the whole directory into the Packages directory.

With Git: Clone the repository in your Sublime Text Packages directory, located somewhere in user's “Home” directory (Preferences -> Browse Packages…):

git clone git://github.com/Kronuz/IndentSize.git

Configuration

One configuration option is available: indent_size; which defaults to tab_size, effectively disabling the plugin.

In my case, I have the following in my Syntax Specific settings for C/C++:

{
    "tab_size": 8,
    "indent_size": 4,
    "translate_tabs_to_spaces": false,
    "detect_indentation": false
}

License

Copyright (c) 2015 by German M. Bravo (Kronuz)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.