MyNixOS website logo
Description

Aligns text prefixes before '=' for consistent formatting.

A utility to adjust text lines by padding spaces before = based on the longest prefix.

align-equal

This project is based on an idea from Gabriella Gonzalez.
For more details, visit: Gabriella's blog

align-equal is a command-line tool that aligns text based on the = symbol.
It ensures that all = signs are vertically aligned, improving readability.

This program reads text from standard input, processes it, and outputs the aligned result to standard output.

Installation

To install align-equal using cabal, run:

cabal install align-equal

Usage

Using in Vim

align-equal is primarily designed for use within Vim. You can align selected text in visual mode as follows:

  1. Select the lines you want to align in visual mode (V for line-wise selection).
  2. Run:
    :!align-equal
    
  3. The selected text will be replaced with an aligned version.

Example

Before (Selected Text in Visual Mode):

x = 1
longVariable = 2
short = 3

Command:

:!align-equal

After:

x            = 1
longVariable = 2
short        = 3

How it Works

align-equal scans the input, detects = symbols, and aligns them by adding the appropriate amount of whitespace.

Metadata

Version

1.0.1.2

License

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows