Reputation: 525
All,
I was wondering if anyone out there was a par guru. I'm mainly wondering if there is a way to get par to see a Fortran comment style that is used in many programs I work with.
For example, if I have:
! 2001Jan01 Jimson Lorem ipsum dolor sit amet, consectetuer adipiscing
! elit. Aenean commodo ligula eget dolor.
! 2002Jan01 Johnny Aenean massa. Cum sociis natoque penatibus et magnis dis parturient
! montes, nascetur ridiculus mus. Donec quam felis, ultricies nec,
! pellentesque eu, pretium quis, sem.
! 2004Feb01 Thompson Nulla consequat massa quis enim. Donec pede justo, fringilla vel,
! aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
! Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus.
It would be nice to run par in vim (with :set formatprg=par
) and get something like:
! 2001Jan01 Jimson Lorem ipsum dolor sit amet, consectetuer adipiscing
! elit. Aenean commodo ligula eget dolor.
! 2002Jan01 Johnny Aenean massa. Cum sociis natoque penatibus et magnis
! dis parturient montes, nascetur ridiculus mus. Donec
! quam felis, ultricies nec, pellentesque eu, pretium
! quis, sem.
! 2004Feb01 Thompson Nulla consequat massa quis enim. Donec pede justo,
! fringilla vel, aliquet nec, vulputate eget, arcu. In
! enim justo, rhoncus ut, imperdiet a, venenatis vitae,
! justo. Nullam dictum felis eu pede mollis pretium.
! Integer tincidunt. Cras dapibus.
where it sees the hanging spaces, etc. Instead par does:
(524) $ par -w80 < text_for_par
! 2001Jan01 Jimson Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
! Aenean commodo ligula eget dolor. 2002Jan01 Johnny Aenean massa. Cum sociis
! natoque penatibus et magnis dis parturient montes, nascetur ridiculus
! mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem.
! 2004Feb01 Thompson Nulla consequat massa quis enim. Donec pede justo,
! fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus
! ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis
! pretium. Integer tincidunt. Cras dapibus.
which, I do admit, is quite well formatted at 80 characters and keeps the "!<space><space>
" at the front.
Unfortunately, par's PARINIT syntax is a bit...mysterious to me. It is entirely possible this is not possible and, if so, okay. But par seems to be powerful in a way like vim is. As long as you know the right confusing character string, it'll do what you want.
Upvotes: 0
Views: 135
Reputation: 8237
I'm not a par expert but if you try something like
cat text_for_par | par 80 -p24 -d1
it should give you what you're looking for. Just look at the man page on par - it tells you how to achieve most things.
Upvotes: 1