Skip to content

Instantly share code, notes, and snippets.

View dougmarcey's full-sized avatar

Doug Marcey dougmarcey

  • Northern VA, USA
  • 16:31 (UTC -04:00)
View GitHub Profile
#!/usr/bin/ruby
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to something a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
def fix_keymap(km_str)
#!/usr/bin/perl
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to something a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
#!/usr/bin/perl
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to somthing a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
#!/usr/bin/ruby
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to somthing a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
def fix_keymap(km_str)
#!/usr/bin/ruby
def fix_keymap(km_str)
km_str.gsub!(/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/,'HYPR(\1)')
km_str.gsub!(/LGUI\(LSFT\((.*?)\)\)/,'SGUI(\1)')
km_str.gsub!(/LALT\(LCTL\((.*?)\)\)/,'LCA(\1)')
km_str.gsub!(/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/,'LCGS(\1)')
km_str.gsub!(/LCTL\(LSFT\((.*?)\)\)/,'LCS(\1)')
km_str.gsub!(/MT\(MOD_HYPR, (.*?)\)/,'HYPR_T(\1)')
km_str.gsub!(/MT\(MOD_MEH, (.*?)\)/,'MEH_T(\1)')
#!/usr/bin/perl
# Tool to convert Ergodox-EZ Configurator generated keymaps
# to somthing a little easier to read/work with.
#
# runs like:
# cleanup.rb [downloaded keymap.c] > [destination keymap.c]
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
#!/usr/bin/ruby
def fix_keymap(km_str)
km_str.gsub!(/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/,'HYPR(\1)')
km_str.gsub!(/LGUI\(LSFT\((.*?)\)\)/,'SGUI(\1)')
km_str.gsub!(/LALT\(LCTL\((.*?)\)\)/,'LCA(\1)')
km_str.gsub!(/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/,'LCGS(\1)')
km_str.gsub!(/LCTL\(LSFT\((.*?)\)\)/,'LCS(\1)')
km_str.gsub!(/MT\(MOD_HYPR, (.*?)\)/,'HYPR_T(\1)')
km_str.gsub!(/MT\(MOD_MEH, (.*?)\)/,'MEH_T(\1)')
#!/usr/bin/perl
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
$keymap = <FILE>;
close(FILE);
$keymap =~ s/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/HYPR($1)/g;
$keymap =~ s/LGUI\(LSFT\((.*?)\)\)/SGUI($1)/g;
$keymap =~ s/LALT\(LCTL\((.*?)\)\)/LCA($1)/g;
$keymap =~ s/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/LCGS($1)/g;
$keymap =~ s/LCTL\(LSFT\((.*?)\)\)/LCS($1)/g;
#!/usr/bin/perl
open(FILE,$ARGV[0]) || die "Can't open the file [$!]\n";
local $/;
$keymap = <FILE>;
close(FILE);
$keymap =~ s/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/HYPR($1)/g;
$keymap =~ s/LGUI\(LSFT\((.*?)\)\)/SGUI($1)/g;
$keymap =~ s/LALT\(LCTL\((.*?)\)\)/LCA($1)/g;
$keymap =~ s/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/LCGS($1)/g;
$keymap =~ s/LCTL\(LSFT\((.*?)\)\)/LCS($1)/g;
#!/usr/bin/ruby
def fix_keymap(km_str)
km_str.gsub!(/LALT\(LCTL\(LGUI\(LSFT\((.*?)\)\)\)\)/,'HYPR(\1)')
km_str.gsub!(/LGUI\(LSFT\((.*?)\)\)/,'SGUI(\1)')
km_str.gsub!(/LALT\(LCTL\((.*?)\)\)/,'LCA(\1)')
km_str.gsub!(/LCTL\(LGUI\(LSFT\((.*?)\)\)\)/,'LCGS(\1)')
km_str.gsub!(/LCTL\(LSFT\((.*?)\)\)/,'LCS(\1)')
km_str.gsub!(/MT\(MOD_HYPR, (.*?)\)/,'HYPR_T(\1)')
km_str.gsub!(/MT\(MOD_MEH, (.*?)\)/,'MEH_T(\1)')