digraphs: warn if vim returns insufficient input
[sheet.git] / tools / mkdigraphs-vim
1 #!/bin/sh
2
3 VERSION=1.00
4
5 vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
6         if ($. == 1) { # head
7                 say "# digraphs list from vim version ", s/\s*\z//r;
8                 say "+{";
9         } else { # body
10                 say "q{$1} => $3," while /\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g;
11         } END { # foot
12                 say "}";
13                 exit warn "only $. lines of :digraphs output\n" if $. < 6;
14         }
15 '