Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "expand" text in Vim, into a nice to read way?

Tags:

text

vim

ruby

I work a lot with nested data structures, and many times I have to manually analyze them from the console. The problem is that they come printed all in one line.

Is there an easy way of re-structuring the display of a data structure based on {,[,],} and the comma, such that it will look like Ruby's pretty_print output?

like image 278
paulot Avatar asked Aug 22 '12 22:08

paulot


1 Answers

:%s/\([{,]\)/\1\r/g
ggVG=
:set ft=ruby

wheeeee

like image 87
Andy Ray Avatar answered Oct 01 '22 23:10

Andy Ray