Search code examples
vimtabular

Vim Tabularize by //


How do you align comments by // with Vim Tabular plugin?

double n; // number of steps
double np; // number of particles
double q; // probability of success

I know that it's easy to align by, i.e., = like this :Tab /=. But :Tab / // adds a space between /'s and it stops to be a comment any more:

double n;  /  / number of steps
double np; /  / number of particles
double q;  /  / probability of success

Solution

  • :Tabularize / \/\/ seems to work.

    Here we are escaping the slashes.