DigitalNomad
DigitalNomad

Reputation: 1031

Vim Formatprg PAR to justify comments with Date Stamp

I am using PAR paragraph reformatter. It is an incredible tool to be used with Vim. I am having a situation where, I have a comment that has date, developer initials and the comment message. I want to align (justified) it using Par, so that it maintains the indentation for date and initials. Is that possible?

Here is what I have:

enter image description here

Here is what it does when I try:

set formatprg=par\ r80j

enter image description here

Desired result:

enter image description here

Thank you.

Upvotes: 2

Views: 314

Answers (1)

sidyll
sidyll

Reputation: 59287

I don't recommend setting this as the standard formatting program options, unless this is your standard way of writing any text. So here is a filter version, better for single uses:

:%!par 80p25dhj

I'm assuming you want a 80 final width and justified text. Remove j or change 80 if needed. Also, the width of the prefix is a guess. Please check it:

;  2012/12/12  AB    Lorem ipsum ....
^                   ^
|-------------------| This width in the original text

I guessed 25 but use a correct number.

Upvotes: 3

Related Questions