Currently, I'm thinking of an easy hack in the event.pm file:
use vars qw(%keybinding);
%keybinding = (
... default keybinding
);
my @user_bindings = do 'user_keybinding.pl';
while (@user_bindings) {
my ($k,$v) = splice @user_bindings, 0, 2;
$keybinding{$k} = $v;
};
sub key_down_filter {
my ($sci_frame, $event) = @_;
my $key = $event->GetKeyCode;
if ($event->AltDown) {
$key = "a$key";
};
# same for shift, ctrl, meta, footpad, escape
if (exists $keybinding{$key}) {
# dispatch
$keybinding{$key}->($sci_frame,$event,$key);
};
};
Update: I should add that using this scheme, it's not really easy to do multi-key combinations a la WordStar or vi - to implement these, multiple dispatch tables are needed. But as a first start I think this kind of keybinding will be enough. |