Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I usually use Textmate, which can do this by pressing option+command+right-bracket and it evenly spaces out a selection of declared variables with values. Same goes for arrays as well, it will space out the keys and their assigned values. For context check out #2 on the following page.

I have to use Notepad++ at work and was wondering how to do the same thing via shortcut key or menu option.

Before variables/array keys are spaced out evenly.

$var = 'value';
$my_var = 'value';
$data = array(
    'my_key' => 'value',
    'some_other_key' => 'value'
);

After variables/array keys are spaced out evenly.

$var    = 'value';
$my_var = 'value';
$data = array(
    'my_key'        => 'value',
    'some_other_key' => 'value'
);
share|improve this question
up vote 4 down vote accepted

I don't know of a shortcut, but this can be down through the TextFX menu.

Select the lines that you want to align, then select TextFX -> TextFX Edit -> Line up multiple lines by (=). In your case, you would select the var and my_var lines, align them, then do the same for the my_key and some_other_key lines. Note that TextFX will trim whitespace, but it's easy to re-add with a column select for spaces before the = and the typical behaviour for multiline indenting.

Edit: Apparently, TextFX doesn't like your array. Don't know why, but I'll look into possible solutions.

Edit 2: It's because a ' was missing for some_other_key.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .