Skip to content
Permalink
Browse files

Make formatting mail easier

  • Loading branch information...
frioux committed Jun 15, 2019
1 parent dd590f2 commit 6f581da759f1deec95b76c7387911691ea574c4f
Showing with 36 additions and 0 deletions.
  1. +5 −0 bin/README.mdwn
  2. +30 −0 bin/mailfmt
  3. +1 −0 vimrc
@@ -296,6 +296,11 @@ Downloads a few packages that import a given package.

`sort` for csv, without messing up the header line.

### `mailfmt`

Formats input with `fmt -w80` until it sees `-- `, and thus leaves signature
alone.

### `mc`

Filter to make output monochrome.
@@ -0,0 +1,30 @@
#!/usr/bin/perl

use strict;
use warnings;

no warnings 'uninitialized';

my @lines = <STDIN>;

my $end = @lines-1;
my $sigstart = $end;

for my $i (0 .. $end) {
if ($lines[$i] eq "-- \n") {
$sigstart = $i - 1;
last
}
}

open my $fh, '|-', 'fmt', '-w80'
or die "Couldn't run fmt -w80: $!\n";

for my $l (@lines[0..$sigstart]) {
print $fh $l
}
close $fh;

for my $l (@lines[$sigstart+1..$end]) {
print $l
}
1 vimrc
@@ -34,6 +34,7 @@ augroup vimrc

au FileType perl setlocal formatprg=perltidy
au FileType go setlocal formatprg=gofmt
au FileType mail setlocal formatprg=mailfmt

au FileType sql setlocal commentstring=--\ %s
au FileType sml setlocal commentstring=(*\ %s\ *)

0 comments on commit 6f581da

Please sign in to comment.
You can’t perform that action at this time.