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 994
  • Mac 367
  • Linux 346
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 Apr 10 Apr 9 Apr 8 Apr 7 Apr 6 Apr 5 Apr 4 Apr 3 Apr 2 Apr 1 Mar 31 Mar 30 Mar 29 Mar 28 Mar 27 Mar 26 Mar 25 Mar 24 Mar 23 Mar 22 Mar 21 Mar 20 Mar 19 Mar 18 Mar 17 Mar 16 Mar 15 Mar 14 Mar 13 Mar 12
Windows 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
Mac 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 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
Linux 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 0 0 0 0 0 0 0 0 0 0 0 0 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.