Lugaru's Epsilon
Programmer's
Editor 14.04

Context:
Epsilon User's Manual and Reference
   Commands by Topic
      . . .
      Moving Around
         Simple Movement Commands
         Moving in Larger Units
         Searching
         . . .
         Comparing Many Files
      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.

The align-by-tab command modifies tab-delimited text in the region (text that uses a single tab character to mark each new column, such as text copied from a spreadsheet), reformatting it using spaces and tabs so the text appears in columns. It makes each column just wide enough for its contents.

Standard bindings:

  Ctrl-c Ctrl-a  align-region
   align-by-tab
 



Previous   Up    Next
Indenting Commands  Commands by Topic   Automatically Generated Text


Lugaru Epsilon Programmer's Editor 14.04 manual. Copyright (C) 1984, 2021 by Lugaru Software Ltd. All rights reserved.