Vim "Align" plugin

There are some Vim plugins I don't know how I lived without before I found them. One I found just last week is Align, which turns this:

@label = Label.new(@frame, -1, "Choose an option:", DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER)
@selector = ListBox.new(@panel, -1, DEFAULT_POSITION, DEFAULT_SIZE, [], LB_SINGLE)
@button = Button.new(@frame, -1, 'OK')

into this:

@label    = Label.new  (@frame, -1, "Choose an option:", DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER)
@selector = ListBox.new(@panel, -1, DEFAULT_POSITION   , DEFAULT_SIZE    , []          , LB_SINGLE)
@button   = Button.new (@frame, -1, "OK")

These mappings are helpful to quickly align some visually-selected lines of code by comma, left paren or equal sign:

vmap <silent> <Leader>i= <ESC>:AlignPush<CR>:AlignCtrl lp1P1<CR>:'<,'>Align =<CR>:AlignPop<CR>
vmap <silent> <Leader>i, <ESC>:AlignPush<CR>:AlignCtrl lp0P1<CR>:'<,'>Align ,<CR>:AlignPop<CR>
vmap <silent> <Leader>i( <ESC>:AlignPush<CR>:AlignCtrl lp0P0<CR>:'<,'>Align (<CR>:AlignPop<CR>

Speak Your Mind

Preview

Commenting Help

Email / Avatar

  • Supply your email address and your Gravatar will be used.
  • I will never email you and your address won't be published.

No HTML allowed!

All HTML is auto-escaped. Use Markdown. Examples:

  • *emphasis* = emphasis
  • **strong** = strong
  • [link](http://foo.bar) = <a href="http://foo.bar">link</a>
  • `code in backticks` = code in backticks
  •     code indented 4 spaces =
    code indented four spaces
  • > Angle-brace quoted text =
    Angle-brace quoted text