Skip to content

Instantly share code, notes, and snippets.

@crcx
Forked from lsparrish/gist:3895813
Created October 15, 2012 22:23
Show Gist options
  • Save crcx/3896020 to your computer and use it in GitHub Desktop.
Save crcx/3896020 to your computer and use it in GitHub Desktop.
prefix-based keybindings in retro
needs struct'
with struct'
variables| prefix lastbinding |
'; !prefix
{
1 field .link
1 field .label
1 field .xt
} bind
: bind: ( d"- )
@lastbinding &bind clone dup !lastbinding !
getc @lastbinding !.label
@lastbinding !.xt ;
&words bind: w
&.s bind: s
[ dup @prefix ==
[
drop getc
lastbinding [ @ dup 0 == [ 2drop -1 ]
[ 2over @.label == [ nip .xt @ do -1 ] [ 0 ] if ] if ] until
32
] ifTrue
] is remapKeys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment