Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

89 lines (65 sloc) 3.591 kb

Sublime Text 2 AStyle Formatter Plugin

Description

SublimeAStyleFormatter is a simple code formatter plugin for Sublime Text 2. It provides ability to format C, C++, C#, and Java files.

Prerequisites (Linux Only)

  1. ctypes can't be imported in Linux right now in the Linux versions of Sublime Text 2, However, a workaround is provided by mnus.
  2. The Linux libastyle.so is not provided right now:
    1. Download and compile astyle: cd astyle/build/gcc; make shared
    2. Copy libastyle.so to SublimeAStyleFormatter directory: cp ../../bin/libastyle.so "~/.Sublime Text 2/Packages/SublimeAStyleFormatter"

Installation

With the Package Control plugin

The easiest way to install SublimeAStyleFormatter is through Package Control.

Once you have Package Control installed, restart Sublime Text 2.

  1. Bring up the Command Pattle (Ctrl+Shift+P on Windows and Linux. Command+Shift+P on OS X).
  2. Type "Install" and select "Package Control: Install Package".
  3. Select "SublimeAStyleFormatter" from list. The advantage of using Package Control is that it will keep SublimeAStyleFormatter up to date.

Manual Install

Without Git: Download the latest source code, and extract to the Packages directory.

With Git: Type the following command in your Sublime Text 2 Packages directory:

git clone git://github.com/timonwong/SublimeAStyleFormatter.git

The "Packages" directory is located at:

Windows %APPDATA%\Sublime Text 2\Packages\
Linux ~/.Sublime Text 2/Packages/
OS X ~/Library/Application Support/Sublime Text 2/Packages/

Usage

Key Bindings

The default key bindings for this plugin:

Windows, Linux:

ctrl+alt+f Format current file

OSX:

super+alt+f Format current file

What's New

v1.1 (2/5/2012)

  • Add support for OS X.
  • More comprehensive options.

License

This plugin is using MIT License

Copyright (c) 2012 Timon Wong

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.

Credits

Artistic Style - A Free, Fast and Small Automatic Formatter for C, C++, C#, and Java Source Code

Licensed under GNU Lesser General Public License version 3.0

Jump to Line
Something went wrong with that request. Please try again.