Home

Awesome

AlignTab

test codecov <a href="https://packagecontrol.io/packages/AlignTab"><img src="https://packagecontrol.herokuapp.com/downloads/AlignTab.svg"></a> <a href="https://www.paypal.me/randy3k/5usd" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-blue.svg" /></a>

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

Getting started

<img width=650 src="https://user-images.githubusercontent.com/1690993/30779107-029a5934-a0b5-11e7-8523-7a3bb657b8f2.png">

More complicated usage

More about regex and options

Live Preview Mode

<img width=650 src="https://cloud.githubusercontent.com/assets/1690993/23576654/4d4fe048-0079-11e7-9fed-ece0850b1312.gif">

Table Mode

<img width=650 src="https://cloud.githubusercontent.com/assets/1690993/23576656/567bacec-0079-11e7-86ce-deaab5907acb.gif">

Hit <kbd>ESC</kbd> or use the command AlignTab: Exit Table Mode to exit table mode.

Installation

Package Control

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.

<img width=300 src="https://cloud.githubusercontent.com/assets/1690993/23576648/13fb5020-0079-11e7-9ffa-a10d5443192d.png">

License

AlignTab is licensed under the MIT License.