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 1K
  • Mac 376
  • Linux 350
Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7 Nov 6 Nov 5 Nov 4 Nov 3 Nov 2 Nov 1 Oct 31 Oct 30 Oct 29 Oct 28 Oct 27 Oct 26 Oct 25 Oct 24 Oct 23 Oct 22
Windows 0 0 0 0 0 0 0 1 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 1 0 0 0 0 0 1 0
Mac 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 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 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.