💾 Archived View for bbs.geminispace.org › u › oldernow › 13076 captured on 2023-12-28 at 15:54:52. Gemini links have been rewritten to link to archived content
-=-=-=-=-=-=-
---------------------- | my wife awoke me | | in wee hours | | to fix my | | limp | | | | slept 'til 8:46am | | not a record | | but up there | | | | not a ton of | | usenet action | | but it'll do | | | | tonight we're out | | celebrating with | | a birthday girl | | | | whipped out the | | small guitar | | yesterday | | | | my wife doesn't | | like it | | and I'll admit | | it's sound is | | smaller | | | | but i can eq | | around that | | and it's just | | such a joy | | of simplicity | | to play | | | | i'm feeling the | | slight tug | | of the 3x5 cards | | again | | | | a way they were | | my earliest days | | of posting | | | | jot, scribble | | insert shapes | | shade | | | | text++ | | | | and | | of course | | not by way of | | commands or clicks | | conducting code | | and hardware | | to perform | | equivalent | | lifting | ----------------------
23 hours ago · 👍 stack
OK, I have to ask if you manually formatted that!
@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....)
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*