From: Mischa POSLAWSKY Date: Wed, 22 Mar 2017 23:18:48 +0000 (+0100) Subject: digraphs: ignore ansi commands in vim version output X-Git-Tag: v1.9~5 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/5afa7fd2694585c96a2ce5e9b6803507f8cfe1b4 digraphs: ignore ansi commands in vim version output Recent versions of Vim v7.4 prepend the expected version number by various escapes (probably terminal-dependent), causing an unreadable result of: \e[?1049h\e[?1h\e=\e[1;63r\e[?25h\e[?25h\e[?25l\e[63;1H704 Assume nothing is put after the wanted number, so capture only that. --- diff --git a/tools/mkdigraphs-vim b/tools/mkdigraphs-vim index b9ab426..c1dcbe4 100755 --- a/tools/mkdigraphs-vim +++ b/tools/mkdigraphs-vim @@ -1,6 +1,6 @@ #!/bin/sh -VERSION=1.01 +VERSION=1.02 if [ "$#" -ne 0 ] then @@ -11,7 +11,7 @@ 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 "# digraphs list from vim version ", m/(\d+)\s*\z/; say "+{"; } else { # body while (/\G(\S\S) (.[^ ]*) +([0-9]+)\s+/g) {