Column formatting in vim
On a linux box, say you have text like this:
name age occupation
bob 22 programmer
nathaniel 111 painter
jo 14 studentVisually select the lines in vim and type !column -t
You should now see:
name       age  occupation
bob        22   programmer
nathaniel  111  painter
jo         14   studentWritten by Matthew Boehm
Related protips
4 Responses
 
I prefer using Tabular gem.
over 1 year ago
·
 
Although I use tabular for this kind of things, it is a nice use of shell features from vim. Thanks :)
over 1 year ago
·
 
Tabular's awesome if you plan on doing this a lot, but I figured this was a good example of using bash filters, and may come in handy if you don't have tabular installed on whatever box you're on.
over 1 year ago
·
 
if you have variable assignments like foo=bar you can also align those by simply using
:'<,'>s/=/ = /
before the !column -t 
call
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
 #Vim 
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#
 
 
 
