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

Align Arguments

by denniskempin ST3

Sublime Text 3 Plugin to automatically format and align argument lists on the opening bracket

Labels formatting

Details

Installs

  • Total 29K
  • Win 21K
  • OS X 5K
  • Linux 3K
Oct 19 Oct 18 Oct 17 Oct 16 Oct 15 Oct 14 Oct 13 Oct 12 Oct 11 Oct 10 Oct 9 Oct 8 Oct 7 Oct 6 Oct 5 Oct 4 Oct 3 Oct 2 Oct 1 Sep 30 Sep 29 Sep 28 Sep 27 Sep 26 Sep 25 Sep 24 Sep 23 Sep 22 Sep 21 Sep 20 Sep 19 Sep 18 Sep 17 Sep 16 Sep 15 Sep 14 Sep 13 Sep 12 Sep 11 Sep 10 Sep 9 Sep 8 Sep 7 Sep 6 Sep 5 Sep 4
Windows 38 39 38 44 29 26 47 53 32 51 50 28 30 24 21 24 28 36 18 32 44 50 48 35 52 33 34 50 58 68 50 46 30 48 66 65 48 49 28 16 26 38 28 40 49 43
OS X 15 9 10 10 6 2 11 4 5 8 4 5 2 8 7 10 8 11 6 6 7 12 7 16 7 7 9 10 7 23 11 8 6 12 15 29 12 6 10 2 3 9 12 9 11 6
Linux 5 5 5 7 4 4 4 4 3 8 3 3 1 3 3 8 12 7 3 2 6 7 12 6 6 3 4 5 7 4 11 2 6 2 13 8 2 8 4 2 4 3 8 6 1 8

Readme

Source
raw.​githubusercontent.​com

align-arguments

Sublime Text 3 Plugin to automatically format and align argument lists on the opening bracket

Many style guides require that argument lists are formatted in the following way:

ReturnType ClassName::ReallyLongFunctionName(Type par_name1, Type par_name2,
                                             Type par_name3) {
  DoSomething();
  ...
}

With the argument list lining up with the opening parenthesis. This can be tedious to format when renaming functions with a long list of arguments, which is why this plugin exists. It provides two commands. Place the cursor inside an argument list like this one

ReturnType ClassName::ReallyLongFunctionName(Type par_name1, Type par_name2, Type par_name3) {

“Format Argument” will reformat the list of arguments and wrap the line if it exceeds the maximum line length (80 by default). The output will be matching the requirement above.

Alternatively you can run wrap lines yourself and let it just do the indentation with the “Align Arguments” command on a snippet like this:

ReturnType ClassName::ReallyLongFunctionName(Type par_name1,
    Type par_name2,
    Type par_name3) {

Which will turn into:

ReturnType ClassName::ReallyLongFunctionName(Type par_name1,
                                             Type par_name2,
                                             Type par_name3) {

Configuration:

"align_arguments": {
  "line_length": 120,
  "one_per_line": true,
}

line_length: Maximum line length. Defaults to the first ruler on the current file, but can be overwritten with this parameter. one_per_line: When the argument list becomes too long for a single line, put each argument on a separate line. Default: false.