summaryrefslogtreecommitdiff
path: root/do-ctrl.pl
blob: 8f3d92cafd318f9a834240fbee90881f94cf4b2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/perl 
use strict;
use warnings;
use 5.012;
use File::Slurp 'edit_file';
 
edit_file {
    s{
(?<pre> key \s+ (?<key> [A-Z] ) \s\{
.*?)
^\s+ alt,ctrl,meta:\s+none$
(?<post> .*? \})
}{
"$+{pre}    ctrl:                               '\\x".sprintf('%02x',ord($+{key})-ord('@'))."'
    alt, meta:                          none$+{post}"
}smxge;
shift;