🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #205482

[vim] Can Blinky's vim/slrn macro be adjusted to work with newspost?

#205482
From: Ohmster
Date: Sun, 09 Sep 2007 07:12
97 lines
4764 bytes
My friend Blinky in news.software.readers showed me a cool macro to use 
with vim when I am using it as my editor in slrn:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hey, plug this into your vimrc and see if it reformats the way you want
after you've edited a bunch of a reply.  (I saw your req in c.e.)

au BufNewFile,BufRead ~/.article,~/.followup :nmap <F5> gg/^$<CR>V/^-- 
$<CR>{gq^

Do a bunch of editing; more than one para; make lines lengths ugly.

Then press F5.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

This macro works pretty good, vim does to line wrapping when used with 
slrn but this macro compacts the whole thing down, nice and neat, and 
stops at the sig delimiter. Nice. But since slrn/vim already line wraps 
by itself, what I really need this macro for is to use when I use 
newspost to do binary uploads. newspost will bring up vim as my prefece 
editor where I can type a message, prior to posting and then when I close 
vim with :wq, newspost will commence posting.

When I use newspost -E (Start newspost and bring up EDITOR, vim in my 
case), it is not very Usenet friendly. I have to pull in my sig with 
delimiter by doing :r~/sig (I have a symlink from sig to .signature), 
then type out the full message, then do either gq <enter> or Q <enter> on 
each paragraph to get them to line wrap and all of this is a bit of a 
pain in the arse.

newsposts makes it's temp text files in a different place than slrn, see 
this from .newspostrc:
From .newspostrc:
# directory for storing temporary files
tmpdir=/tmp/ohmster_newspost

Info from /tmp while making a post with vim during a newspost session:

[ohmster@ohmster ohmster_newspost]$ pwd
/tmp/ohmster_newspost

* Show you where we are. newspost is up with vim as the editor.

[ohmster@ohmster ohmster_newspost]$ ls -la
total 16
drwxrwxr-x  3 ohmster ohmster 4096 Sep  7 00:19 .
drwxrwxrwt 19 root    root    4096 Sep  6 23:06 ..
drwx------  2 ohmster ohmster 4096 Sep  7 00:19 newspost-mEldwU

* Showing the contents of the temp dir with another active vim edit 
session.

[ohmster@ohmster ohmster_newspost]$ ls -la
total 16
drwxrwxr-x  3 ohmster ohmster 4096 Sep  7 00:20 .
drwxrwxrwt 19 root    root    4096 Sep  6 23:06 ..
drwx------  2 ohmster ohmster 4096 Sep  7 00:20 newspost-HN4MMs

* Show contents of temp dir with a new newspost session, new vim post 
session:

[ohmster@ohmster ohmster_newspost]$

So how can I incorporate this info into your macro to make it useful in 
newspost? It seems that the temp files are always:
/tmp/ohmster_newspost/newspost-HN4MMs

Where the last 6 charaters are random. I tried modifiying the macro as 
such:

au BufNewFile,BufRead ~/.article,
~/.followup,/tmp/ohmster_newspost/newspost-* :nmap <F5> gg/^$<CR>V/^-- 
$<CR>{gq^

(All one line)

And this *does* work, but it always ignores the first paragraph. No 
matter if there is a lot of text or just a bit, the first paragraph is 
always ignored by this macro. What am I doing wrong and how can I make 
this macro useful for newspost so that pressing F5 will always format ALL 
paragraphs and not ignore the first one?

Bonus points awarded for bringing in the sig line at the same time to 
eliminate the need to do:
:r~/sig

(My sig is below and does contain the sig delimiter so this r colon thing 
does bring it all in.)

Can anyone help or give me some pointers here? Thank you very much.

-- 
~Ohmster | ohmster /a/t/ ohmster dot com
Put "messageforohmster" in message body
(That is Message Body, not Subject!)
to pass my spam filter.
Technical Details
Message-ID: <Xns99A6207AAF21AMyBigKitty@194.177.96.26>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.editors.mbox.zip!g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <Xns99A6207AAF21AMyBigKitty@194.177.96.26>
Subject: [vim] Can Blinky's vim/slrn macro be adjusted to work with newspost?
Date: Sun, 09 Sep 2007 07:12:00 +0000
From: Ohmster <root@dev.nul.invalid>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-comp.editors.mbox.zip!g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!not-for-mail
Newsgroups: comp.editors,news.software.readers
Followup-To: comp.editors
Organization: Ohm's Fish Market
Lines: 96
NNTP-Posting-Host: O/RjhamsI9EKzsYUTMrueA.user.aioe.org
X-Complaints-To: abuse@aioe.org
User-Agent: Xnews/2006.08.24
X-Face: .XlXp$frDJgk"+lb;#RRo7mu{1=_.HV?RtB}%$JLN.!>>|\CPyQIi3/aBRW#(.dd8zlF9N]k8{xh03zVf=zG1G6{.bb%H8Vs%|7l'1YWAw+A)x'S"-}(Y`#ZN`#04OktRpU*!NdugZh(o%w5K,?/WqZ(qWs}K)Req:&D'|lkj%*a[N0bMk^Tr<PY{Sz6YcFm'[*2fkS/RV>}L.;=6evum0C,LE}%s@g;]-DhWu4J"DbcJ*+fIo,l8cH@ZxF|dm~;Vg;XxV@K!Wp|SV+3HPyIOS,Z'j]jz]i=/5*!J&hVOQ[