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 55K
  • Win 41K
  • OS X 8K
  • Linux 6K
Oct 24 Oct 23 Oct 22 Oct 21 Oct 20 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
Windows 6 28 38 32 24 14 27 23 102 111 24 19 17 25 20 25 28 24 19 24 20 25 15 25 17 22 20 19 24 31 30 37 13 17 23 29 35 40 39 15 13 15 28 25 27 29
OS X 2 6 4 7 2 4 2 7 19 15 5 2 3 7 6 6 5 1 4 3 1 6 3 7 2 1 7 3 1 5 6 1 4 3 7 5 4 5 4 0 1 2 3 1 1 3
Linux 0 2 1 4 2 3 4 6 16 10 1 0 2 7 4 6 4 2 3 0 4 4 6 4 4 1 1 2 3 4 1 5 4 1 3 1 4 3 2 1 1 1 3 2 2 6

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.