AlignTab
An alignment plugin for Sublime Text using regular expression
Details
Installs
- Total 172K
- Win 101K
- Mac 44K
- Linux 27K
| 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 | Jul 7 | Jul 6 | Jul 5 | Jul 4 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 2 | 6 | 3 | 6 | 3 | 2 | 3 | 1 | 3 | 3 | 9 | 4 | 1 | 5 | 3 | 3 | 3 | 4 | 3 | 7 | 5 | 0 | 0 | 2 | 2 | 7 | 6 | 6 | 3 | 6 | 6 | 4 | 10 | 9 | 5 | 5 | 3 | 7 | 17 | 6 | 0 | 0 | 0 | 0 |
| Mac | 1 | 2 | 1 | 2 | 3 | 3 | 3 | 0 | 0 | 0 | 1 | 2 | 4 | 5 | 4 | 0 | 0 | 2 | 4 | 3 | 2 | 4 | 3 | 2 | 2 | 5 | 4 | 2 | 1 | 0 | 1 | 2 | 3 | 2 | 3 | 7 | 4 | 2 | 6 | 8 | 0 | 0 | 1 | 0 | 0 |
| Linux | 0 | 0 | 2 | 2 | 4 | 2 | 3 | 3 | 4 | 1 | 2 | 1 | 2 | 5 | 1 | 2 | 2 | 1 | 0 | 4 | 3 | 6 | 0 | 2 | 1 | 2 | 1 | 1 | 2 | 0 | 1 | 5 | 0 | 2 | 1 | 4 | 1 | 1 | 5 | 5 | 0 | 0 | 0 | 1 | 0 |
Readme
- Source
- raw.githubusercontent.com
AlignTab
The most flexible alignment plugin for Sublime Text 3. This plugin is inspired by the excellent VIM plugin, tabular.
ST2 support is deprecated but however, it is still possible to install AlignTab on ST2 via Package Control.
Features
- Align using regular expression
- Custom spacing, padding and justification.
- Smart detection for alignment if no lines are selected
- Multiple cursors support
- Table mode and Live preview mode
Getting started
- If you only want simple and quick alignment, the predefined alignment will help.

More complicated usage
- Open
AlignTabin Command PaletteC+Shift+pand enter the input in the form of<regex>/<option>. - To learn more about regular expression, visit here and here.
- The option controls column justification, padding and maximum number of splits. A general syntax of options is
([rlc][0-9]*)*(f[0-9]*)?. - The numbers after
r,corldetermine how many spaces will be added after columns and the number afterfcontrols how many matches will be made based<regex>. - For example,
c2r3f1means- first column is centered followed by 2 spaces
- second column is right-flushed followed by 3 spaces
- only the first match is used
- If the number after
[rlc]is omitted, 1 space will be added after each column. - If the number after
fis omitted, only the first match will be used. - The entire option could be omitted (i.e., input only the regular expression). In that case, default option,
l1f0will be used. It means:- All columns are left-justified.
- A space is added after each column.
- All matched delimiters are aligned.
More about regex and options
- Use non-capturing parenthese
(?:regex)instread of capturing parenthese. - Delimiter is also treated as a column.
- For example,
=/rclmeans the the column before=will be right-justifed and the column after=will be left-justified. And=will be centered (however, it doesn't matter as=is of length 1).
- For example,
- The option for alignment cycles through the columns.
- For example,
regex/rlmeans all odd columns will be right-justified and all even columns will be left-justified.
- For example,
- The symbol
*repeats the preceeding justification flags.- For example
r*3equalsrrr, and(cr3)*2equalscr3cr3.
- For example
- (Experimental) Besides
r,candl, there is a newuflag which stands for “unjustified”.
Live Preview Mode

Table Mode

Hit ESC or use the command AlignTab: Exit Table Mode to exit table mode.
Installation
Examples
Some simple examples. You can also contribute your examples there.
Keybinds
If you are interested in getting a keybind for live preview mode, add the following in your user keybinds file.
{
"keys": ["super+shift+a"], "command": "align_tab",
"args" : {"live_preview" : true}
}
For frequent patterns, you can consider the following in your user keybinds file. Change the keybind and the user_input for your purpose.
//align =
{
"keys": ["super+shift+a"], "command": "align_tab",
"args" : {"user_input" : "=/f"}
}
or syntex specific keybind.
// latex align keybind, to align & and \\, but not \&
{
"keys": ["super+shift+a"], "command": "align_tab",
"args" : {"user_input" : "(?<!\\\\)&|\\\\\\\\"},
"context":[
{ "key": "selector", "operator": "equal", "operand": "text.tex.latex" }
]
}
Named patterns
To make it easier to remember complex patterns, you can save them in a dictionary in the settings file. To edit the patterns, launch Preferences: AlignTab Settings. Use the name as key and the regex as value. For examples,
"named_patterns": {
"eq" : "=/f",
// right hand side could also be an array of inputs
"ifthen" : ["=/f", "\\?/f", ":/f"]
}
You then just use the name instead of the pattern in the input field.
Custom Context Menu
To define new item in the context menu, launch Preferences: AlignTab Context Menu and add, for example
[
{"caption" : "-"},
{
"id": "aligntab",
"caption": "AlignTab",
"children": [
{
"caption" : "{",
"command" : "align_tab",
"args" : {"user_input" : "\\{"}
}
]
}
]
CJK Support
AlignTab supoorts CJK characters, but you have to choose a correct font face and font size.
To my knowledge, MinCho works on all Chinese, Japanese and Korean.

License
AlignTab is licensed under the MIT License.