StandardNerd
StandardNerd

Reputation: 4183

vim tabularize align selected rows

How do you align selected rows with Vim Tabular plugin?
I have a code like:

def initialize(attributes = {})
  @name = attributes[:name]  
  @email = attributes[:email]
end

:Tab /= produces this, even with selecting rows @name and @email in visual mode.

def initialize(attributes = {})
  @name                   = attributes[:name]  
  @email                  = attributes[:email]
end

How can one make vim tabularize plugin to format:

def initialize(attributes = {})
  @name  = attributes[:name]  
  @email = attributes[:email]
end

even with one row (the @email row) selected vim aligns the = in the rows @name and @email to that one in attributes =

Upvotes: 0

Views: 260

Answers (1)

timss
timss

Reputation: 10260

Unless you're dead set on using Tabular or Tabularize (I'm guessing you mean the first one), there's also Align (Github). They seem to do more or less the same, but Align works just fine for me on that piece of code.

  • Align whole file: :Align =
  • Align on visual line: <leader>t= or :'<,'>Align = (i.e. : from visual line).

Upvotes: 1

Related Questions