git.shiar.nl
/
sheet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vi: describe functionality of g^g in visual mode
[sheet.git]
/
tools
/
mkdigraphs-vim
diff --git
a/tools/mkdigraphs-vim
b/tools/mkdigraphs-vim
index a94812fe942f52a8eb4a513e3c28906e3ffa6fc5..b9ab42668896fa77eea51b844da490e904282025 100755
(executable)
--- a/
tools/mkdigraphs-vim
+++ b/
tools/mkdigraphs-vim
@@
-1,13
+1,25
@@
#!/bin/sh
#!/bin/sh
-VERSION=1.00
+VERSION=1.01
+
+if [ "$#" -ne 0 ]
+then
+ echo "Usage: $0 >digraphs-vim.inc.pl"
+ echo 'Collect digraph data from vim, standard output as Perl hash.'
+ exit 64 # EX_USAGE
+fi
vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
if ($. == 1) { # head
say "# digraphs list from vim version ", s/\s*\z//r;
say "+{";
} else { # body
vim -e -c'echo version' -cdigraphs -cq | perl -CSD -nE '
if ($. == 1) { # head
say "# digraphs list from vim version ", s/\s*\z//r;
say "+{";
} else { # body
- say "q{$1} => $3," while /\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g;
+ while (/\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g) {
+ my ($mnem, $chr, $cp) = ($1, $2, $3);
+ $mnem =~ s/(?=[\\}])/\\/g; # escape string delimiter
+ $chrstr = sprintf q("\x{%x}"), $cp;
+ say "q{$mnem} => $chrstr,";
+ }
} END { # foot
say "}";
exit warn "only $. lines of :digraphs output\n" if $. < 6;
} END { # foot
say "}";
exit warn "only $. lines of :digraphs output\n" if $. < 6;