Home Download Buy Blog Forum Support

Help Requested: Modify VAlign

Help Requested: Modify VAlign

Postby Saxi on Thu Jun 13, 2013 5:45 am

I spoke with the author of the VAlign plugin, and he currently isn't updating the plugin. It works great in ST3 which is why I like it and it is much more intelligent than "Alignment" as you don't need to select text and it will auto align. But it does not handle new lines and I don't know Python to modify it to allow that.

I'd like to be able to align this automatically without grouping them together then splitting them apart again after:

local a = 'a'
local a2 = 'a'

local b = 'b'
local bb = 'bb'

Right now, it will align either one, if you select one then do the second one, it aligns both but not relative to each other.
Saxi
 
Posts: 100
Joined: Mon Nov 19, 2012 1:37 pm

Re: Help Requested: Modify VAlign

Postby randy3k on Thu Jun 13, 2013 8:48 am

try this, it will do the job.
https://github.com/randy3k/AlignTab

There are two ways to do this
1) select the piece of code you want to align, or
2) put a cursor in one of the lines in each block of code
then apply the alignment.

It detects the alignment blocks and handles the alignment globally.
randy3k
 
Posts: 46
Joined: Sun Nov 18, 2012 5:16 am

Re: Help Requested: Modify VAlign

Postby Saxi on Thu Jun 13, 2013 9:43 am

randy3k wrote:try this, it will do the job.
https://github.com/randy3k/AlignTab

There are two ways to do this
1) select the piece of code you want to align, or
2) put a cursor in one of the lines in each block of code
then apply the alignment.

It detects the alignment blocks and handles the alignment globally.


Don't you have to create Regex for each alignment you want per syntax.
Saxi
 
Posts: 100
Joined: Mon Nov 19, 2012 1:37 pm

Re: Help Requested: Modify VAlign

Postby randy3k on Thu Jun 13, 2013 9:48 am

If you want to define a keybind just to align "=", put the following into your user keybind file (change the key if you want)

Code: Select all
  //align =
  {
    "keys": ["super+shift+a"], "command": "align_tab",
    "args" : {"user_input" : "=/f"}
  }

This keybind works for all syntaxes.

If you want to define syntax specific keybind, then consider the following
Code: Select all
  //align = for python
  {
    "keys": ["super+shift+a"], "command": "align_tab",
    "args" : {"user_input" : "=/f"},
    "context":   [ { "key": "selector", "operator": "equal", "operand": "source.python" } ]
  }
randy3k
 
Posts: 46
Joined: Sun Nov 18, 2012 5:16 am


Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 7 guests