Tom Plagge on 15 Aug 2003 03:13:49 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[hosers-talk] A nifty trick for vi and mh


So if you're like me, your mh aliases file is completely out of control.  I
don't even remember which aliases I gave to which people.  What I really want
to do is just search it for some text, and have the matching record dumped
in my To: line, or Cc: line, or whatever.  I created a stupid little script
to do searches, called ~/bin/mha:

#!/bin/sh
if [ $# -gt 0 ]; then
  grep $1 ~/Mail/aliases | awk '{ for ( i=2; i<NF; i++ ) { printf("%s ", $i) } printf("%s\n", $NF) }'
else
  read  -e foobar
  mha $foobar
fi

But then I had to exit vi to run the script, which pissed me off, so I created
a vi keyboard mapping:

map! ^L ^[$Bma0"ld`a!!mha^M0"lP$a

Now when I want to send email to, say, Joel, I just type:
To: joel<CTRL-L>
and it changes the line to
To: Joel Uckelman <uckelman@xxxxxxxxxxx>

This rocks.
-t
_______________________________________________
hosers-talk mailing list
hosers-talk@xxxxxxxxxxx
http://lists.ellipsis.cx/mailman/listinfo/hosers-talk