-
-
Save crcx/3896020 to your computer and use it in GitHub Desktop.
prefix-based keybindings in retro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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