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

Align Arguments

by denniskempin ST3 Trending

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

Labels formatting

Details

Installs

  • Total 61K
  • Win 46K
  • Mac 9K
  • Linux 6K
Jul 12 Jul 11 Jul 10 Jul 9 Jul 8 Jul 7 Jul 6 Jul 5 Jul 4 Jul 3 Jul 2 Jul 1 Jun 30 Jun 29 Jun 28 Jun 27 Jun 26 Jun 25 Jun 24 Jun 23 Jun 22 Jun 21 Jun 20 Jun 19 Jun 18 Jun 17 Jun 16 Jun 15 Jun 14 Jun 13 Jun 12 Jun 11 Jun 10 Jun 9 Jun 8 Jun 7 Jun 6 Jun 5 Jun 4 Jun 3 Jun 2 Jun 1 May 31 May 30 May 29 May 28
Windows 0 21 13 17 16 23 12 12 9 25 18 14 24 23 17 8 11 18 16 17 22 15 21 22 17 18 23 15 7 21 18 27 13 24 19 8 11 24 15 28 35 22 16 19 19 19
Mac 0 6 5 1 2 4 2 3 0 3 4 3 1 6 2 2 3 6 8 2 2 3 3 2 3 4 2 3 3 1 3 2 2 3 4 4 1 2 6 3 2 3 2 4 7 4
Linux 0 0 5 4 1 2 1 3 1 1 0 0 1 0 2 2 0 5 1 6 0 0 2 1 2 0 2 5 2 0 5 1 5 3 2 2 0 2 3 3 0 2 2 1 2 4

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.