I have the requirement of separating an ASCII document into pages of max length 58 lines per page. At the bottom of each page there is a 3 line footer. I'm not aware of any pagination abilities within Vim that would accomplish this.
Is there a good way to do this with Vim? Perhaps highlighting every 58th line or something of the sort.
N.B. I'm seeing answers involving using a separate tool to do this; which I have thought of. What I'm interested in is a Vim solution.
Thanks.
The proper tool you're looking for is very likely a2ps.
a2ps --lines-per-page 58 --footer=footer_text document.txt
It's possible in vim as a script. Put the following in a file and :source it while the file to change is open. The s:footer list are the lines to insert after each run of 58 lines.
let s:footer = ["","Footer",""]
let s:line = 0
while s:line <= line("$") - 58
let s:line = s:line + 58
call append(s:line, s:footer)
let s:line = s:line + len(s:footer)
endwhile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With