💾 Archived View for bbs.geminispace.org › u › oldernow › 13087 captured on 2023-12-28 at 16:09:15. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
@stack The process:
1) type text manually in vim
2) :<first-line-number>,<last-line-number>!center
3) :<first-line-number>,<last-line-number>!box
4) :<first-line-number>,<last-line-number>s/^/ /
where 'center' is a script to center text, and 'box' is a script to create the box around text. (4) is to pad the text on the left so it doesn't look quite so "up against the left".
(And of course one surrounds the text in the good 'ole triple backticks....)
23 hours ago
Where is the outrage about this pornography being published in the library? Tone it back down to a limp will ya? lol
~ Sacasm :)
Cool. Would you consider sharing your scripts? They seem pretty useful.
@stack Here be the Lua scripts. You'll see they're not well documented, but read from stdin and write to stdout, making the perfect to run against lines in a vim session a la:
NOTE: The source code below contains tab characters.
Looks like "center" takes a couple optional arguments related to some kind of additional padding.
Let's say you start with this on lines 1 through 4 in a vim session:
this is a test to see what happens
running ":1,4!center" leads to:
this is a test to see what happens
running ":1,4!center @" leads to:
@@@@this@@@@ @is a test@@ @@@to see@@@ what happens
(see how it used argument one as a padding character?)
running ":1,4!center @ x" leads to:
@@@@this @is a test @@@to see what happens
So apparently the second argument (which can be anything) leads to the padding occurring only at the front of lines.
#! /usr/bin/env lua local pad = ' ' if arg[1] then pad = arg[1] end t = {} max = 0 for line in io.stdin:lines() do line = string.gsub(line, '^%s*', '') line = string.gsub(line, '%s*