Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/randy3k/aligntab
An alignment plugin for Sublime Text using regular expression
https://github.com/randy3k/aligntab
alignment sublime-text
Last synced: 5 days ago
JSON representation
An alignment plugin for Sublime Text using regular expression
- Host: GitHub
- URL: https://github.com/randy3k/aligntab
- Owner: randy3k
- License: mit
- Created: 2012-12-10T02:25:22.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2021-11-16T17:52:44.000Z (about 3 years ago)
- Last Synced: 2024-10-19T05:57:46.312Z (3 months ago)
- Topics: alignment, sublime-text
- Language: Python
- Homepage:
- Size: 1.4 MB
- Stars: 631
- Watchers: 13
- Forks: 25
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# AlignTab
[![test](https://github.com/randy3k/AlignTab/actions/workflows/test.yaml/badge.svg)](https://github.com/randy3k/AlignTab/actions/workflows/test.yaml)
[![codecov](https://codecov.io/gh/randy3k/AlignTab/branch/master/graph/badge.svg)](https://codecov.io/gh/randy3k/AlignTab)
The most flexible alignment plugin for Sublime Text 3. This plugin is inspired by the excellent VIM plugin, [tabular](https://github.com/godlygeek/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 `AlignTab` in Command Palette `C+Shift+p` and enter the input in the form of `/`.
- To learn more about regular expression, visit [here](http://www.regular-expressions.info) and [here](https://docs.python.org/2/library/re.html).
- 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`, `c` or `l` determine how many spaces will be added after columns and the number after `f` controls how many matches will be made based ``.
- For example, `c2r3f1` means
- 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 `f` is 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, `l1f0` will 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, `=/rcl` means 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).
- The option for alignment cycles through the columns.
- For example, `regex/rl` means all odd columns will be right-justified and all even columns will be left-justified.
- The symbol `*` repeats the preceeding justification flags.
- For example `r*3` equals `rrr`, and `(cr3)*2` equals `cr3cr3`.
- (Experimental) Besides `r`, `c` and `l`, there is a new `u` flag which stands for "unjustified".## Live Preview Mode
## Table Mode
Hit ESC or use the command `AlignTab: Exit Table Mode` to exit table mode.
## Installation
[Package Control](http://wbond.net/sublime_packages/package_control)
## Examples
Some simple examples. You can also contribute your examples [there](https://github.com/randy3k/AlignTab/wiki/Examples).
## 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" : "(?## License
AlignTab is licensed under the MIT License.