GithubHelp home page GithubHelp logo

aligntab's Introduction

AlignTab

An alignment plugin for Sublime Text 2/3 -- ST version of the excellent VIM plugin, tabular.

Features

  • Align with user defined regular expression
  • Custom spacing, padding and justification.
  • Smart detection for alignment if no lines are selected
  • Multiple cursors support
  • Table mode: super efficient for editing tables

Usage

###First time user

  • Predefined alignment tools can be found under the mouse menu Align By

###Advanced user

  • Open AlignTab in Command Palette C+Shift+p
  • The input should be in the from of regex/option
  • The option, e.g., c2r2f1, controls
  • column justification: r, l or c
  • spaces after each column: the number after r, l or c
  • max number of delimiters: the number after f
  • 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.
  • Default option is l1f0.
  • All columns are left-justified.
  • A space is added after each column.
  • All matched delimiters are aligned.
  • Do not use capturing parenthese for regular expression. Instead, use non-capturing parenthese (?:regex).

###Table Mode

Installation

Package Control

Keybinds

For frequent patterns, put the following keybind in your user keybinds file. (Remember to change the key and regex.)

 //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. Use the name as key and the regex as value. These patterns are included in the default file:

  "named_patterns": {
     "first_equal": "=/f",
     "first_comma": ",/f",
     "first_colon": ":/f"
  }

You then just use the name instead of the pattern in the input field. To edit the patterns, go to Perferences -> Package Settings -> AlignTab -> Settings.

aligntab's People

Contributors

randy3k avatar randybot avatar tarwich avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.