Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
         . . .
         Comparing
      Changing Text
         . . .
         Rearranging
         Indenting Commands
         Aligning
         Automatically Generated Text
         Spell Checking
         . . .
      Language Modes
         Asm Mode
         Batch Mode
         C Mode
         . . .
         Visual Basic Mode
      . . .

Previous   Up    Next
Indenting Commands  Commands by Topic   Automatically Generated Text


Epsilon User's Manual and Reference > Commands by Topic > Changing Text >

Aligning

The align-region command on Ctrl-C Ctrl-A aligns elements on lines within the current region. It changes the spacing just before each element, so it starts at the same column on every line where it occurs.

It uses alignment rules specialized for the current mode. By default, it aligns the first "=" character on each line, and any comments on the lines.

For C mode, Epsilon additionally aligns the names of variables being defined (in simple definitions), the definitions of macros in #define lines, and the backslash character at the end of preprocessor commands. It can change

int hour = 3;       // The hour.
short int minute = 22; // The minute.
int second = 14;                // The second.

#define GET_HOUR()  hour        // Get the hour.
#define GET_MINUTE()  minute  // Get the minute.
#define GET_SECOND()  second        // Get the second.

into

int        hour   = 3;        // The hour.
short int  minute = 22;       // The minute.
int        second = 14;       // The second.

#define GET_HOUR()    hour    // Get the hour.
#define GET_MINUTE()  minute  // Get the minute.
#define GET_SECOND()  second  // Get the second.

You can disable individual alignment rules by setting the align-region-rules variable, or increase the minimum spacing used by all automatic rules by setting the align-region-extra-space variable.

The command can also perform alignments specified manually. Run it with a numeric prefix argument, and it will prompt for a regular expression pattern that defines the alignment rule. It must consist of two parenthesized patterns, such that in a regular expression replacement, #1 and #2 would substitute their text. Alignment will alter the spacing between these two elements. Manual alignment will also prompt for the amount of additional spacing to be added between the two elements.

To use the built-in mode-based rules, but add extra space, run align-region with a numeric prefix, but enter nothing for the search pattern. The command will prompt for the amount of additional space and apply it using the mode's default alignment rules, as if you had temporarily modified the align-region-extra-space variable.

Standard bindings:

  Ctrl-C Ctrl-A  align-region
 



Previous   Up    Next
Indenting Commands  Commands by Topic   Automatically Generated Text


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.