views:

771

answers:

4

I would like to automatically align lines of python variable assignments in vim.

For example I would like to change this:

a = 1
banana = 2

into this

a      = 1
banana = 2

automatically in vim.

Is there a way to do this?

+1  A: 

The Align plugin does this and much more.

Brian Carper
+1  A: 

Try the align plugin.

It's described here...

Zsolt Botykai
+10  A: 

You are probably looking for the Align plugin for vim:

http://www.vim.org/scripts/script.php?script_id=294

Once installed, you simply select the text you want to align (Shift V) and type:

:Align =

This will align the text based on the = character, so you can use anything you want really.

Hope that helps!

Bartek
A: 

Just note that this goes against style guidelines ;)

lazy1