summaryrefslogtreecommitdiff
path: root/do-ctrl.pl
diff options
context:
space:
mode:
Diffstat (limited to 'do-ctrl.pl')
-rw-r--r--do-ctrl.pl17
1 files changed, 17 insertions, 0 deletions
diff --git a/do-ctrl.pl b/do-ctrl.pl
new file mode 100644
index 0000000..8f3d92c
--- /dev/null
+++ b/do-ctrl.pl
@@ -0,0 +1,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;