Skip to content

Latest commit

 

History

History
44 lines (35 loc) · 1.06 KB

File metadata and controls

44 lines (35 loc) · 1.06 KB

Vim plugin to align text by a delimiter

WidthAlign aligns the last occurrence of a delimiter within each line of the selected range by inserting spaces before the delimiter so that all delimiters appear in the same screen column.

Lines that do not contain the delimiter are left unchanged. Alignment is based on the displayed column, so tabs are handled correctly.

Commands

    :[range]WidthAlign [delimiter]

Align the last occurrence of {delimiter} in each line of the range. Without range works on the whole file. The default delimiter is "\".

Examples

    :WidthAlign

Align all lines with trailing backslashes.

    :5,20WidthAlign =

Align assignment operators between lines 5 and 20 inclusive.

    :'<,'>WidthAlign #

Align trailing comments.

    :'<,'>WidthAlign ->

Align the last "->" on each line.

Installation

mkdir -p ~/.vim/pack/width-align/start
cd ~/.vim/pack/width-align/start
git clone https://github.com/termctrlseq/width-align.vim
vim -u NONE -c "helptags width-align/doc" -c q