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 53K
  • Win 39K
  • OS X 8K
  • Linux 5K
Aug 22 Aug 21 Aug 20 Aug 19 Aug 18 Aug 17 Aug 16 Aug 15 Aug 14 Aug 13 Aug 12 Aug 11 Aug 10 Aug 9 Aug 8 Aug 7 Aug 6 Aug 5 Aug 4 Aug 3 Aug 2 Aug 1 Jul 31 Jul 30 Jul 29 Jul 28 Jul 27 Jul 26 Jul 25 Jul 24 Jul 23 Jul 22 Jul 21 Jul 20 Jul 19 Jul 18 Jul 17 Jul 16 Jul 15 Jul 14 Jul 13 Jul 12 Jul 11 Jul 10 Jul 9 Jul 8
Windows 18 31 38 23 19 13 18 17 32 23 24 16 17 24 27 31 38 26 19 21 30 31 26 29 27 15 15 25 31 20 18 34 22 16 22 28 38 32 32 15 25 30 23 31 25 26
OS X 4 1 3 2 1 2 5 6 2 4 9 0 4 5 5 1 1 5 1 2 7 4 5 5 3 3 1 6 8 3 3 7 2 3 3 4 4 7 3 3 2 0 5 6 4 4
Linux 0 4 4 2 1 1 3 5 4 3 3 3 1 2 3 4 1 4 3 3 1 2 4 1 5 2 1 3 5 1 6 4 1 0 4 3 2 2 4 1 1 1 3 7 3 5

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.