• Stars
    star
    280
  • Rank 146,585 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

SublimeAStyleFormatter is a code formatter/beautifier for Sublime Text 2 & 3. It provides ability to format C/C++/C#/Java files.

Sublime Text 2 & 3 AStyle Formatter Plugin

Travis-CI Build Status AppVeyor Build Status

Description

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

NOTE: Syntax files required to be installed separately for Cuda-C++ and OpenCL.

Donation

If you find my work useful, please consider buying me a cup of coffee, all donations are much appreciated :)

Donate via PayPal

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.

  1. Bring up the Command Palette (Ctrl+Shift+P on Windows and Linux. ++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 it to the Packages directory.

With Git:

Type the following command in your Sublime Text 2 or Sublime Text 3 Packages directory:

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

The "Packages" directory is located at:

Sublime Text 2

  • Windows: %APPDATA%\Sublime Text 2\Packages
  • Linux: ~/.config/sublime-text-2/Packages/
  • OS X: ~/Library/Application Support/Sublime Text 2/Packages/

Sublime Text 3

  • Windows: %APPDATA%\Sublime Text 3\Packages
  • Linux: ~/.config/sublime-text-3/Packages/
  • OS X: ~/Library/Application Support/Sublime Text 3/Packages/

Usage

Key Bindings

The default key bindings for this plugin:

Windows, Linux:

  • Ctrl+Alt+F: Format current file.
  • Ctrl+K, Ctrl+F: Format current selection.

OSX:

  • Ctrl+Alt+F: Format current file.
  • +K, +F: Format current selection.

Command Palette

Open the command palette, it appears as SublimeAStyleFormatter: Format Current File and SublimeAStyleFormatter Format Current Selection.

Settings

Per-project Settings

Before starting, you may want to have a look at SublimeAStyleFormatter.sublime-settings.

To edit your project setting, select Project/Edit Project from main menu. A project setting contains per-project settings for SublimeAStyleFormatter should look like this:

{
    "settings":
    {
        "AStyleFormatter":
        {
        }
    }
}

For example, if you don't want to inherit the default settings, instead, use your own astylerc file for C and C++ individually, then your project setting might look like this:

{
    // project folders, etc
    // ...
    // project settings
    "settings":
    {
        "AStyleFormatter":
        {
            "options_default":
            {
                // Use 2 spaces for indentation
                "indent": "spaces",
                "indent-spaces": 2
            },
            "options_c":
            {
                "use_only_additional_options": true,
                "additional_options_file": "/path/to/your/astylerc/for/c"
            },
            "options_c++":
            {
                "use_only_additional_options": true,
                "additional_options_file": "/path/to/your/astylerc/for/c++"
            }
        }
    }
}

What's New

CHANGELOG.md

License

This plugin is using MIT License:

Copyright (c) 2012-2015 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

Donors

DONORS.md

More Repositories

1

prometheus-webhook-dingtalk

DingTalk integration for Prometheus Alertmanager
Go
798
star
2

OmniMarkupPreviewer

Sublime Text 2&3 plugin to live preview markup files, supported (not limited to) markup formats are markdown, reStructuredText, WikiCreole and textile.
Python
499
star
3

uwsgi_exporter

uWSGI metrics exporter for prometheus.io
Go
66
star
4

cyksuid

Fast Python implementation of KSUID (K-Sortable Globally Unique IDs) using Cython
Python
37
star
5

ding2wechat

钉钉机器人到企业微信机器人转发器
Go
30
star
6

sxsdiff

Side by side diff for python
Python
17
star
7

loggercheck

A linter for logr,klog,zap that can also works with golangci-lint as a plugin
Go
13
star
8

ScalaFormat

Yet another Scala code formatter for Sublime Text.
Python
13
star
9

elasticsearch-discovery-ecs

Aliyun ECS unicast discovery plugin for Elasticsearch
Java
9
star
10

astyle-mirror

[Unofficial] mirror of astyle (http://astyle.sourceforge.net)
C++
8
star
11

pyastyle

astyle library as a python module
Python
8
star
12

libao

[Mirror] Cross Platform Audio Output Library http://xiph.org/ao/
C
8
star
13

vscode-ansible-autocomplete

TypeScript
6
star
14

smart-table-improved

Collection of useful widgets for the smart-table
JavaScript
6
star
15

dbr

Additions to Go's database/sql for super fast performance and convenience. (fork of gocraft/dbr, Go 1.8+)
Go
6
star
16

python27-rpm

Shell
5
star
17

jaeger-client-python-contrib

Python
5
star
18

SublimeAlternate

SublimeAlternate is a simple working in progress plugin for Sublime Text 2. It provides simple ways to alternate files (like swithing .c to .h) by keyboard shortcuts quickly.
Python
4
star
19

todolint

Go
3
star
20

k8sutils

Go
2
star
21

webpack-angular-gettext

TypeScript
2
star
22

grpc_with_gevent_will_screw_you

Python
1
star
23

wasm-limit-size-filter

Proxy-Wasm Request/Response Size Limit Filter
Rust
1
star
24

undisposition-addon

Removes Content-Disposition: attachment HTTP header to allow view files instead of downloading them. Extension icon acts as toggle.
TypeScript
1
star
25

foo_uie_wsh_panel_mod

Automatically exported from code.google.com/p/foo-wsh-panel-mod
C++
1
star
26

alauda-pipeline-cover

Go
1
star
27

dotfiles

dotfiles managed by chezmoi
Shell
1
star
28

vagrant-rabbit-clusters

Shell
1
star
29

logrlint

(Archived) Please use https://github.com/timonwong/loggercheck instead
Go
1
star