Using tabularize in vim is really sweet, but one thing that I don't like is when I have one column in a set that is particularly long that messes all the others up. Generally, I like to have my text width be 80 characters or less. Otherwise, when you split vertically, you get a mess of readability. Consider the following:
mlog->_ofile << "INS=" << string((char *) ins_asm) << delimiter <<
" in Img: " << (img_name!=0 ? string( (char*) img_name) : "INVALID") <<
delimiter << " at IP=" << setbase(16) << insPointer << delimiter <<
" Time: " << setbase(10) << time << delimiter;
you would generally align this with a simple visual selection then :Tab /<<. But the long column starting with (img_name!=
... messes everything up: it forces all the other columns to be really long. It would be cool if tabularize had a varible that you could set so that it would automatically find the optimal spacing and arrangement of tokens to make for the shortest legal statement, but this is more arduous to do for each language, its best to be able to quickly split by text width.
:set tw=80 doesn't do the job either just to note.
How can one both align this statement quickly with tabularize, and also have it insert newlines where appropriate?
The results not pretty :) but try
:Tab /<<
Select range
type gq
It looks like the following.
There's a non visual method
:%s/\(.\{78}\)/\1\r/g
But it looks worse